
319 S.E.2d 607 (1984)
311 N.C. 717
C. E. SAMPLE t/a Sample Construction Company
v.
Patrick H. MORGAN and wife, Irene S. Morgan.
No. 116A84.
Supreme Court of North Carolina.
August 28, 1984.
*608 O.C. Abbott, Elizabeth City, for plaintiff-appellant.
Trimpi, Thompson & Nash by C. Everett Thompson, Elizabeth City, for defendants-appellees.
MEYER, Justice.
The record discloses the following facts pertinent to the resolution of the issues presented:
By complaint filed 15 January 1981, plaintiff, a licensed building contractor, alleged that he and defendants entered into a contract for the purpose of building a residential dwelling for defendants; that the *609 total cost of the building was $139,998.90; that defendants had paid plaintiff the sum of $120,331.82; and that defendants had refused to pay the balance due in the amount of $19,667.08.
In their answer, filed 27 January 1981, defendants admitted entering into a contract with the plaintiff for the purpose of building a residential dwelling; that the cost of the dwelling was $139,998.90; and that plaintiff had been paid $120,331.82. Defendants denied owing plaintiff any amount. Defendants amended their complaint on 13 February 1981, substituting for the original sum of $120,331.82 the new sum of $121,114.61, representing the amount they had admitted paying to the plaintiff.
On 1 October 1981 defendants moved for summary judgment. In response to defendants' motion, plaintiff submitted affidavits disclosing inter alia that he had a general contractor's license limited to $125,000.00 on any single project; that the original estimated cost of the project was $115,967.81; that during the course of construction, defendants requested certain modifications totalling an additional cost of $24,075.97; and that defendants purchased some of these materials, although they were charged to plaintiff's account, and that he had no control over the prices paid for them. On 24 May 1982, the trial judge denied defendants' motion for summary judgment.
Finally, on 26 August 1982, defendants moved to amend their answer alleging:
1. That pursuant to N.C.G.S. § 87-1, et seq., the plaintiff is not entitled to recover any sums of money from the defendants in that the plaintiff was not properly licensed to construct a project as alleged in the complaint in that plaintiff was licensed as a general contractor only up to a cost of $125,000.00 and the defendants plead this as a bar to plaintiff's claim.
2. That plaintiff is barred on its claim and plaintiff's claim is void and unenforceable on account of the statute of frauds.
The case was tried before a jury. Following presentation of the plaintiff's evidence and again at the close of all the evidence, defendants moved for "dismissal" pursuant to Rule 50 of the North Carolina Rules of Civil Procedure,[1] arguing that plaintiff had shown by his own evidence that "he was licensed [as a general contractor] for $125,000.00" and that "the cost of the undertaking exceeded the statutory amount in that plaintiff's (sic) claimed his undertaking was in excess of $130,000.00." The trial judge reserved ruling on the motions and submitted the case to the jury. The jury returned a verdict in favor of the plaintiff in the amount of $11,000.00. Defendants moved for judgment notwithstanding the verdict and this motion was granted. From this judgment, plaintiff appealed to the Court of Appeals. That court affirmed the judgment below, holding that "a contractor who violates statutory licensing requirements may not enforce a construction contract against an owner." 66 N.C.App. at 340, 311 S.E.2d at 48. The Court of Appeals then concluded, "On this record plaintiff cannot collect more than $125,000.00 on his contract with defendants." Id.
Judge Eagles, in his dissenting opinion, took the position that "a licensed general contractor has complied with Chapter 87 when the contractor is licensed throughout the negotiation, contracting and construction process, the estimated construction cost under the original contract is within the dollar limits of his license, and any subsequent variations from the plans and specifications of the original contract are at *610 the initiation of the other party and are merely acquiesced in by the contractor." Id. at 341, 311 S.E.2d at 48.
Plaintiff contends that the trial judge erred in granting defendants' motion for judgment n.o.v., thereby barring his recovery of an amount in excess of what he had already received. Plaintiff's general contractor's license is limited to the amount of $125,000.00 on any single project. The jury awarded plaintiff $11,000.00 which, together with the amount he had been paid, would total an amount well in excess of the $125,000.00 limit on his license.[2]
Defendants take the position that plaintiff is barred from recovery of any amount on his claim.
In support of his position, plaintiff would have us consider, as did Judge Eagles in his dissenting opinion, the following facts: plaintiff's original estimate, after negotiations with defendants, was $115,000.00, a figure well within the plaintiff's authorized license limit. Although plaintiff acquiesced in defendants' requested additions and changes made during the course of the construction, which additions and changes substantially increased the cost of the structure, plaintiff took no part in defendants' decision to modify the original plans. Thus, argues plaintiff, he should not be required to bear the costs of modifications which inured solely to the benefit of the defendants and which were incurred solely as a result of their request for variations of the original plan.
Plaintiff's arguments are persuasive. However, our interpretation of Chapter 87, its purpose and underlying policy, together with our recent decision in Brady v. Fulghum, 309 N.C. 580, 308 S.E.2d 327 (1983), dictates our rejection of the arguments of both parties.
G.S. § 87-10, provides in pertinent part: [T]he holder of an unlimited license shall be entitled to engage in the business of general contracting in North Carolina unlimited as to the value of any single project, the holder of an intermediate license shall be entitled to engage in the practice of general contracting in North Carolina but shall not be entitled to engage therein with respect to any single project of a value in excess of four hundred twenty-five thousand dollars ($425,000), the holder of a limited license shall be entitled to engage in the practice of general contracting in North Carolina but the holder shall not be entitled to engage therein with respect to any single project of a value in excess of one hundred twenty-five thousand dollars ($125,000) and the license certificate shall be classified as hereinafter set forth.
* * * * * *
The Board shall conduct an examination, either oral or written, of all applicants for license to ascertain the ability of the applicant to make a practical application of his knowledge of the profession of contracting, under the classification contained in the application, and to ascertain the qualifications of the applicant in reading plans and specifications, knowledge of estimating costs, construction, ethics and other similar matters pertaining to the contracting business and knowledge of the applicant as to the responsibilities of a contractor to the public and of the requirements of the laws of the State of North Carolina relating to contractors, construction and liens. If the results of the examination of the applicant shall be satisfactory to the Board, then the Board shall issue to the applicant a certificate to engage as a general contractor in the State of North Carolina, as provided in said certificate,.... (Emphasis added.)
N.C.Gen.Stat. § 87-10 (1981) (amended 1982).
Clearly the statute contemplates a differing level of expertise for those applying for and receiving a license in the three enumerated categories. In enacting this statute, the legislature reasonably determined that as the cost of a structure *611 increased, there would be additional demands of expertise and responsibilities from the contractor. To permit a general contractor to recover amounts in excess of the allowable limit of his license would vitiate the intended purpose of this statute: to protect the public from incompetent builders. We therefore hold that a general contractor is entitled to recover only up to that amount authorized by his license. In the present case plaintiff is entitled to recover from the defendants an amount not to exceed $125,000.00.
In so holding we reject defendants' position that a contractor who constructs a project, the value of which exceeds the amount of his license, may not recover in any amount for the owner's breach of contract, or for the value of the work and services furnished or materials supplied under the contract on a theory of unjust enrichment. To the extent that Helms v. Dawkins, 32 N.C.App. 453, 232 S.E.2d 710 (1977) and cases cited therein so hold, those cases are overruled. Nor do we believe, as defendants contend, that our holding today is inconsistent with the rationale or result in Brady v. Fulghum, 309 N.C. 580, 308 S.E.2d 327. In that case we expressly rejected the doctrine of "substantial compliance" with the general contractor's licensing statute. The substantial compliance doctrine essentially favored an equitable result following a case by case analysis. In Brady we elected to adopt a "bright line" rule, requiring strict compliance with the licensing provisions of G.S. § 87-1, et seq., "[i]n recognition of the essential illegality of an unlicensed contractor's entering into a construction contract for which a license is required...." Id. at 585, 308 S.E.2d at 331. Likewise, by today's holding we have rejected plaintiff's argument that he is entitled to full recovery because he substantially complied with the Chapter 87 licensing requirements. Our decision in Brady, however, does not support defendants' contention that since the value of the building exceeded the limit of plaintiff's license, his claim is barred by Chapter 87. The issue we addressed in Brady concerned unlicensed contractors who enter into construction contracts for which a license is required. Here the plaintiff held a valid contractor's license and entered into a contract to build a structure which under the contract he was authorized by his license to undertake. In short, until plaintiff exceeded the allowable limit of his license, he was not acting in violation of G.S. § 87-10.
Plaintiff contends that the trial judge erred in granting defendants' motion to amend their answer to allege the affirmative defense of lack of proper licensing. The motion was filed 26 August 1982, approximately 19 months after defendants had filed their answer. Plaintiff argues that the delay in filing the motion to amend was without justification in that defendants knew, at least as early as February 1981, shortly after their answer was filed, that plaintiff's license limited him to an undertaking of $125,000.00 on any single project.
Indeed, the record discloses that on 15 October 1981 plaintiff, in response to defendants' motion for summary judgment, filed an affidavit which reads as follows:
H.M. McCown, being first duly sworn, deposes and says:
1. That he is custodian of the records of the North Carolina Licensing Board for General Contractors, a State agency with the responsibility for licensing general contractors in accordance with N.C. G.S. 87-1, et seq.

2. That said Board is required by law to maintain a list of those persons who are duly licensed as general contractors in the State of North Carolina.
3. That according to said records, C.E. Sample Construction Company, Elizabeth City, North Carolina, was granted license (No. 9228) on October 25, 1977, with a classification of Building Contractor and limitation of Limited (up to $125,000 on any single project).
4. All licenses expire on the thirtyfirst day of December of each year and renewals may be effective any time during the month of January.

*612 5. That according to said records, C.E. Sample Construction Company renewed their license for the years 1978, 1979, 1980 and 1981.
This 17th day of February, 1981.
s/ H.M. McCown
(Sworn to this 17th day of February 1981)
Furthermore, plaintiff submitted on 3 November 1981, again in response to defendants' motion for summary judgment, the following affidavit:
C. E. SAMPLE, being first duly sworn, deposes and says:
1. That he is a general contractor and has been licensed for at least four (4) years. That he had a general contractor's license limited up to $125,000.00 on any single project.
2. That he met with the defendants in August, 1979, and gave them an estimated cost of time and materials plus 10%, according to the plans and specifications shown to him, said estimate being in the amount of $115,967.81.
3. That at that time, it was contemplated that he would purchase the materials and furnish the labor.
4. That after the construction work began, the defendants requested changes in the plans and materials that went into the construction of the home. Some of the changes are as follows: carpet, wallpaper, vinyl, all bathroom fixtures, faucet, gold commode handles, 3 inch crown molding, roof shingles, broken tile on three porches, brick, white mortar, washing machine, dryer, built in double oven, refrigerator, light fixtures, cabinet hardware, cuppola, weather vane, doorlocks, dead bolts, paneling in den, beams in den, mantle in living room, chair railing, inside doors, outside doors, burglar alarm and attachments, screen wire porches, wallpaper mural, and counter top.
5. That he did not purchase some of these materials nor could he control the prices paid for the same.
6. That the total extras were an additional cost of $24,075.97.
This the 30th day of October, 1981.
s/ C.E. SAMPLE
(SWORN TO, this the 30th day of October, 1981).
Thus, although defendants had neglected to plead the licensing defense at the time the motion for summary judgment was heard in May 1982, the issue was squarely before the court upon plaintiff's own admission.
In Bank v. Gillespie, 291 N.C. 303, 306, 230 S.E.2d 375, 377 (1976), we held that "unpleaded defenses, when raised by the evidence, should be considered in resolving a motion for summary judgment," although "it is the better practice to require a formal amendment to the pleadings." In reaching this decision, Justice Branch (now Chief Justice) noted that:
Earlier cases took the view that evidence offered at a hearing on a motion for summary judgment must be supported by allegations in the pleadings. Cudahy Packing Co. v. U.S., 37 F.Supp. 563. The later cases hold that, in light of the policy favoring liberality in the amendment of the pleadings, "[e]ither the answer should be deemed amended to conform to the proof offered by the affidavits or a formal amendment permitted, the affidavits considered, and the motion for summary judgment decided under the usual rule pertaining to the adjudication of summary judgment motions." 6 Moore's Federal Practice ¶ 56.11[3] (2d Ed.1976). See Rossiter v. Vogel, 134 F.2d 908; Bergren v. Davis, 287 F.Supp. 52. Chapter 1A, Rules of Civil Procedure.
Id. (Emphasis added.) See Whitten v. AMC/Jeep, Inc., 292 N.C. 84, 231 S.E.2d 891 (1977); Mangum v. Surles, 281 N.C. 91, 187 S.E.2d 697 (1972); see also Barrett, Robert & Woods v. Armi, 59 N.C.App. 134, 296 S.E.2d 10, disc. rev. denied, 307 N.C. 269, 299 S.E.2d 214 (1982) (holding that the trial court erred in rejecting defendant's defense that plaintiff was barred from recovering under a construction contract because plaintiff was not licensed as a general contractor during the majority of the construction period on the ground that the *613 defense was not properly raised where the defense was raised for the first time in defendant's motion for summary judgment, since unpleaded affirmative defenses are deemed to be part of the pleadings when such defenses are raised in a hearing on a motion for summary judgment).
Thus, for all practical purposes, defendants' answer may be deemed amended to reflect the affirmative defense of lack of proper licensing as of the time the case was before the court on the motion for summary judgment. We therefore find no abuse of discretion in the trial judge's subsequent decision to allow a formal amendment following the hearing on the motion for summary judgment.
We deem it unnecessary to address defendants' cross assignment of error that the trial judge erred in denying their motion for summary judgment.
The case is remanded to the Court of Appeals for further remand to the Superior Court, Currituck County, for entry of judgment in an amount representing the difference between what plaintiff has been paid and $125,000.00.
MODIFIED AND REMANDED.
NOTES
[1]  Plaintiff acknowledges that "our courts have held that it is permissable [sic] for motions made under Rule 41(b) at the close of plaintiff's evidence in jury trials to be treated as motions for directed verdict under Rule 50(a)." See Creasman v. Savings & Loan Assoc., 279 N.C. 361, 183 S.E.2d 115 (1971), cert. denied, 405 U.S. 977 [92 S.Ct. 1204, 31 L.Ed.2d 252] (1972). We therefore find no merit to plaintiffs' contention that defendants' motion for judgment notwithstanding the verdict should not have been entertained upon defendants' failure to properly move for directed verdict.
[2]  We are unable to determine from the record whether plaintiff has been paid $120,331.82, as alleged in his complaint, or $121,114.61, as reflected in defendants' amended answer.
