
681 P.2d 1227 (1984)
Harry LOADER dba Loader Aluminum Company, Plaintiff and Respondent,
v.
SCOTT CONSTRUCTION CORPORATION, Defendant and Appellant.
No. 18305.
Supreme Court of Utah.
April 18, 1984.
*1228 Stanley R. Smith, American Fork, for defendant and appellant.
Craig S. Cook, John H. McDonald, Salt Lake City, for plaintiff and respondent.
DURHAM, Justice:
Appellant Scott Construction Corporation ("Scott") challenges a judgment awarded Harry Loader ("Loader") in the Fourth Judicial District of Utah County. At issue is whether the circumstances of this case permit an exception to the general rule precluding contractors from recovering money owed for work done without a license. We hold that Loader is entitled to the benefit of the exception, and we affirm.
In 1978 and 1979, Loader installed aluminum siding and rain gutters as a subcontractor on various projects for which Scott was the general contractor. While performing this work, Loader did not have his own contractor's license. He testified at trial that his former partner had told him he could work under the partner's license. This information was incorrect, and Loader was not validly licensed as a contractor in Utah at the time he worked for Scott.
Loader sued Scott for payment for the work he had done. At trial, Scott attempted to interpose Loader's unlicensed status as a bar to recovery. The trial judge ruled that Scott had waived this defense by failing to raise it in his pleadings and gave judgment to Loader for $10,000.
Although the error was harmless because of the result we reach on appeal, the trial judge erred in concluding that Scott had waived his defense by failing to raise it in his pretrial pleadings. Under Utah R.Civ.P. 15(b), issues not raised by the pleadings but nevertheless tried by the implied consent of the parties shall be treated in all respects as if they had been raised in the pleadings. Loader's attorney did not object when Scott's attorney cross-examined Loader about his failure to have a license. Instead, Loader's attorney, on redirect, examined Loader to show that Loader believed, in good faith, that he was validly operating under his former partner's license. Scott's attorney argued during closing argument that Loader's failure to have a license resulted in his inability to recover. When asked to respond by the trial judge, Loader's attorney again failed to object to the raising of the issue and failed to claim that he was in any way surprised or prejudiced. Instead, he argued that equitable considerations outweighed *1229 the technical requirement of a license. It is apparent that the attorneys for both Scott and Loader agreed to try the issue of Loader's lack of capacity. Under these circumstances, Utah R.Civ.P. 15(b) dictates that the issue should be treated as if it had been raised in the pleadings, and the fact that the pleadings were never amended does not affect the result of the trial on this issue. We must therefore consider the significance of Loader's unlicensed status.
Scott argues that Loader is statutorily barred from recovery. U.C.A., 1953, § 58-23-1, in effect at the time Loader contracted with Scott, required that a person obtain a license before he engaged in the business of contracting. The statute did not specify any consequence in civil litigation of a failure to obtain the required license. In order to protect the public, this Court adopted a general rule prohibiting an unlicensed contractor from recovering for services rendered under his contracts. Frank R. George v. Oren Limited & Associates, Utah, 672 P.2d 732, 735 (1983); Fillmore Products v. Western States Paving, Utah, 561 P.2d 687, 689 (1977). In 1981, the Legislature repealed title 58, chapter 23 and replaced it with title 58A, chapter 1. Added to the new statutory scheme was § 58A-1-26, which prohibits a contractor not merely from recovering for services, but also from suing
for collection of compensation for the performance of any act for which a license is required by this chapter without alleging and proving that he was a duly licensed contractor when the contract sued upon was entered into and when the alleged cause of action arose.
Scott argues that § 58A-1-26 applies to this case and that it prohibits Loader from recovery in this action. However, § 58A-1-26 took effect on May 12, 1981 (1981 Utah Laws ch. 23, § 26), and Loader's complaint is dated March 31, 1981. Thus this action was commenced before the effective date of the amendment, and § 58A-1-26 has no application to the case at bar.
We therefore consider the doctrine under the unamended statute developed in George, supra; Fillmore, supra; and Lignell v. Berg, Utah, 593 P.2d 800 (1979), to determine whether Loader falls within the exceptions we have permitted to the general rule of nonrecovery for unlicensed contractors. Our common law rule was not mechanically applied. Rather, this Court under the old statute considered the merits of each particular case so as to avoid unreasonable penalties and forfeitures. George, supra, at 735; Fillmore, supra, at 689; Lignell, supra, at 805.
Scott, as a licensed contractor, does not belong to the class of persons the general rule was intended to protect. In Fillmore, we said:
[A] licensed contractor by obtaining his license is, in the eyes of the law, held to expertise in the contracting business and is therefore informed of the necessity for licensing therein and the purpose behind licensing, viz., the protection of the public. The licensed contractor consequently cannot invoke application of the general rule of denying relief to an unlicensed contractor solely because of the latter's non-licensing when a contract for construction is struck between them.
Fillmore, supra, at 690 (emphasis in original). As a licensed contractor, Scott is presumed to possess expertise in the contracting business. Scott, therefore, is not in need of the protection the licensing statute was intended to provide the lay public. No public policy would be served by allowing Scott to invoke application of the common law rule denying relief to an unlicensed contractor.
Furthermore, Scott did not complain at trial about the services or material Loader rendered. Since Scott had an opportunity to show that Loader's work was unsatisfactory and failed to do so, we assume that Loader's performance met Scott's expectations.
Finally, Loader testified that he operated in good faith under the mistaken belief that his former partner's license applied to him. Unlike the willful disregard of the licensing *1230 statute that we disapproved of in George, supra, at 736-37, we find this circumstance to be similar to the inadvertent lapse of a license we identified as a mitigating factor in Lignell, supra, at 805. A good faith mistake alone will not insulate a contractor from application of the general rule denying relief. It is, however, one factor that we may consider in determining the rule's application.
We hold that the general common law rule denying recovery, in effect at the time this action was brought, should not be applied to Loader because (1) Scott was not a member of the class the statute was intended to protect, (2) Loader fully performed the contract, and Scott would be unfairly benefited by avoiding payment for materials and services received, and (3) Loader's unlicensed status was the result of a good faith mistake. The judgment of the trial court is therefore affirmed. Costs to respondent.
HALL, C.J., and STEWART, OAKS and HOWE, JJ., concur.
