
94 Cal.Rptr.2d 756 (2000)
79 Cal.App.4th 1254
PACIFIC CUSTOM POOLS, INC., Cross-Complainant and Appellant,
v.
TURNER CONSTRUCTION COMPANY, Cross-Defendant and Appellant,
Universal City Studios, Inc., Cross-Defendant and Respondent.
No. B122853.
Court of Appeal, Second District, Division Four.
April 17, 2000.
*758 Anne M. Huarte, Hermosa Beach, Girardi and Keese, Timothy O'Brien and James B. Kropff, Los Angeles, for Cross-complainant and Appellant Pacific Custom Pools, Inc.
Orbach & Huff, LLP, Los Angeles, and Howard B. Brown, Los Angeles, for Cross-defendant and Appellant Turner Construction Company.
Arter & Hadden LLP, Jack W. Fleming and James K. Dierking, Irvine, for Cross-defendant and Respondent Universal City Studios, Inc.
*757 BERLE, J.[*]
On this consolidated appeal, Pacific Custom Pools, Inc., challenges the trial court's granting of summary judgment based on the failure of Pacific Custom Pools to substantially comply with the contractor's licensing requirements, and Turner Construction Company questions the court's denial of its attorney's fees. We hold that the trial court properly granted summary judgment but erred in denying attorney's fees.

FACTUAL BACKGROUND AND PROCEDURAL HISTORY
Universal City Studios, Inc. ("Universal") entered into a general contract with Turner Construction Company ("Turner") for the construction of the Jurassic Park ride (the "project") at the theme park in Universal City, California. In turn, Turner entered into a subcontract ("the Agreement") on the project with Pacific Custom Pools, Inc. ("PCP"), pursuant to which PCP agreed to furnish and install all water treatment work for the project for the contract price of $959,131. PCP further subcontracted its work to Harrington Industrial Plastics, Inc. ("Harrington") and Pacific Engineered Projects ("PEP") for those companies to provide materials and supplies on the project. PCP performed work on the project from April 1995 until June 1996 for which it was paid $897, 719. During the period of October 12, 1995 to March 14, 1996, PCP's contractor's license was under suspension, and although the license had also expired as of January 31, 1996, it was not renewed until May 5, 1996.
Harrington filed an action[1] for breach of contract and foreclosure of mechanics' liens against PCP, Turner, and Universal, alleging that PCP had failed to pay $95,941.85 due under a contract for performance of work on the project. PEP also filed suit[2] against the same parties for similar relief, claiming that it was owed $55,587.38 under its contract with PCP.
Turner then filed a cross-complaint against PCP for indemnification against the claims of Harrington and PEP, and later PCP filed a cross-complaint against Turner and Universal, seeking damages of $2,000,000 based on claims that misrepresentations had been made as to the scheduling of the order of work.[3] By order of *759 the superior court the Harrington and PEP cases were deemed related to each other and assigned to an all purpose judge.
On February 27, 1998, the trial court granted summary judgment to Turner and Universal on PCP's cross-complaint on the grounds that PCP was unlicensed during a period of its contract, and under Business and Professions Code section 7031[4] an unlicensed contractor may not maintain an action for work performed. Turner's cross-complaint against PCP for indemnity was thereafter voluntarily dismissed without prejudice.
In the judgment that was entered in favor of Turner and Universal, the court identified Turner and Universal as the prevailing parties. Turner then filed a motion for attorney fees under Code of Civil Procedure section 1032.5 and Civil Code section 1717, which was denied by the court.
PCP appeals from the judgment, and Turner appeals from the order denying attorney fees. Both appeals will be addressed in this opinion.

DISCUSSION

A. Summary Judgment Motion
Under Code of Civil Procedure section 437c, subdivision (o)(2), the statute governing summary judgment motions, "[a] defendant ... has met his or her burden of showing that a cause of action has no merit if that party has shown that one or more elements of the cause of action ... cannot be established, or that there is a complete defense to that cause of action. Once the defendant ... has met that burden, the burden shifts to the plaintiff ... to show that a triable issue of one or more material facts exists as to that cause of action or defense thereto." The appellate court undertakes a de novo review of the trial court's decision to grant summary judgment and is not bound by the reasons or rationales stated by the trial court. (Pensinger v. Bowsmith, Inc. (1998) 60 Cal.App.4th 709, 717, 70 Cal. Rptr.2d 531; Prilliman v. United Air Lines, Inc. (1997) 53 Cal.App.4th at 935, 951, 62 Cal.Rptr.2d 142; Ranchwood Communities Limited Partnership v. Jim Beat Construction Co. (1996) 49 Cal.App.4th 1397, 1408, 57 Cal.Rptr.2d 386.)
In the second amended complaint PCP alleges that at all relevant times it "was licensed by the State of California, under the applicable sections of the Business and Professions Code to do the kind of work" performed under its contract on the project. Turner and Universal filed motions for summary judgment, claiming that they are entitled to judgment as a matter of law because PCP was not a duly licensed contractor all times during its performance on the project and section 7031 bars an unlicensed contractor from maintaining any claim for compensation for work performed. In support of their motions, Turner and Universal presented evidence from the Contractors State License Board ("CSLB") indicating that PCP's license was suspended from October 12, 1995 to March 14, 1996, and that the license was under expiration from January 31, 1996 to May 3, 1996.
Hence, Turner and Universal came forth with evidence to support a complete defense to the action, shifting the burden to plaintiff to show that there was a triable issue of fact with respect to the licensure defense. (Code Civ. Proc., § 437c, subd. (o)(2).) Section 7031, subdivision (c) itself provides that when licensure is controverted, the burden of proof to establish licensure is on the licensee. (See Buzgheia v. Leasco Sierra Grove (1997) 60 Cal.App.4th 374, 383, 389, 70 Cal.Rptr.2d 427.) PCP did not deny that its license was under suspension beginning with October 12, *760 1995.[5] However, PCP contended that summary judgment should not be granted because there was a material issue of fact as to whether PCP "substantially complied" with the licensing statute which, if proven, would allow PCP to pursue its claim.

B. Doctrine of Substantial Compliance with Licensing Requirements
Section 7031, subdivision (a)[6] provides that a contractor may not maintain an action for the recovery of compensation for the performance of work requiring a license unless it was "a duly licensed contractor at all times during the performance of that" work. In Hydrotech Systems, Ltd. v. Oasis Waterpark (1991) 52 Cal.3d 988, 277 Cal.Rptr. 517, 803 P.2d 370, the Supreme Court set forth the social policy underpinning section 7031:
"The purpose of the licensing law is to protect the public from incompetence and dishonesty in those who provide building and construction services. (Lewis & Queen v. N.M. Ball Sons (1957) 48 Cal.2d 141, 149-150 [308 P.2d 713].) The licensing requirements provide minimal assurance that all persons offering such services in California have the requisite skill and character, understand applicable local laws and codes, and know the rudiments of administering a contracting business. (Ibid.; Conderback, Inc. v. Standard Oil Co. (1966) 239 Cal.App.2d 664, 678-679 [48 Cal.Rptr. 901].)
"Section 7031 advances this purpose by withholding judicial aid from those who seek compensation for unlicensed contract work. The obvious statutory intent is to discourage persons who have failed to comply with the licensing law from offering or providing their unlicensed services for pay.
"Because of the strength and clarity of this policy, it is well settled that section 7031 applies despite injustice to the unlicensed contractor. `Section 7031 represents a legislative determination that the importance of deterring unlicensed persons from engaging in the contracting business outweighs any harshness between the parties, and that such deterrence can best be realized by denying violators the right to maintain any action for compensation in the courts of this state. [Citation.]...' (Lewis & Queen, supra, 48 Cal.2d at p. 151 [308 P.2d 713], italics added; see also Brown v. Solano County Business Development, Inc. (1979) 92 Cal.App.3d 192, 198 [154 Cal.Rptr. 700]; Rushing v. Powell (1976) 61 Cal.App.3d 597, 605 [130 Cal.Rptr. 110].)" (Id. at p. 995, 277 Cal. Rptr. 517, 803 P.2d 370.)
Through a series of cases beginning in 1966, the courts attempted to alleviate the severity of the application of section 7031 by allowing recovery to a contractor who has substantially complied with the licensing statutory scheme. (Asdourian v. Araj (1985) 38 Cal.3d 276, 283, 211 Cal.Rptr. 703, 696 P.2d 95; Latipac, Inc. v. Superior Court (1966) 64 Cal.2d 278, 281, 49 Cal. Rptr. 676, 411 P.2d 564; Gaines v. Eastern Pacific (1982) 136 Cal.App.3d 679, 682-683, 186 Cal.Rptr. 421; Airfloor Co. of California, Inc. v. Regents of University of California (1978) 84 Cal.App.3d 1004, 1010, 149 Cal.Rptr. 130; Vitek, Inc. v. Alvarado Ice Palace, Inc. (1973) 34 Cal.App.3d 586, 590, *761 110 Cal.Rptr. 86; Lewis v. Arboles Dev. Co. (1970) 8 Cal.App.3d 812, 816-817, 87 Cal.Rptr. 539.)
In reaction to this development in the law, the Legislature amended section 7031 in 1989 to add a subsection (d) which provided that the substantial compliance doctrine shall not apply to that statute. (Stats.1989, ch. 368, § 1; Hydrotech Systems, Ltd. v. Oasis Waterpark, supra, 52 Cal.3d at p. 996, fn. 5, 277 Cal.Rptr. 517, 803 P.2d 370.) In 1991, the Legislature further amended section 7031 to provide an exception to the prohibition of the substantial compliance doctrine where noncompliance with licensure requirements was the result of inadvertent clerical error or other error or delay not caused by the negligence of the licensee.[7] (See Construction Financial v. Perlite Plastering Co. (1997) 53 Cal.App.4th 170, 177-178, 61 Cal.Rptr.2d 574.)
Section 7031, subdivision (d) was amended in 1994 to its present state. The statute reads:
"(d) The judicial doctrine of substantial compliance shall not apply under this section where the person who engaged in the business or acted in the capacity of a contractor has never been a duly licensed contractor in this state. However, the court may determine that there has been substantial compliance with licensure requirements under this section if it is shown at an evidentiary hearing that the person who engaged in the business or acted in the capacity of a contractor (1) had been duly licensed as a contractor in this state prior to the performance of the act or contract, (2) acted reasonably and in good faith to maintain proper licensure, and (3) did not know or reasonably should not have known that he or she was not duly licensed...."
An unlicensed contractor may thus avoid the consequences of the prohibition against the substantial compliance doctrine under section 7031, subd. (d) if the contractor proves that it had been licensed before performing work, acted reasonably in trying to maintain a license and did not know or reasonably should not have known that it was not licensed. The parties concur that PCP was licensed before commencing work on the project. However, the parties dispute whether PCP acted reasonably and in good faith to maintain its license, and whether PCP knew or should have reasonably known that it was not licensed.
In support of its contention that it substantially complied with licensing requirements, PCP submitted the declaration of James F. Barger, president of PCP, stating that unbeknownst to him the license of PCP was suspended on October 12, 1995 under section 7071.6,[8] but he did not find *762 out about the suspension until January 1996. Section 7071.6, in effect in 1995, required a licensee to notify the registrar of contractors of the CSLB in writing of any entered and unsatisfied judgments within 90 days from the date of judgment. Failure to provide such notification results in automatic license suspension. Barger explained in his declaration that sometime prior to 1994 he had a dispute with a supplier, Tim Goodwin; he had posted a bond for the amount owed; and thereafter entered into a settlement and made payments to Goodwin. At some point unknown to Barger, the bonding company filed for bankruptcy and a judgment was entered against PCP. After Barger was informed of the license suspension, he attempted to contact Goodwin and learned that Goodwin had passed away. Barger then contacted Goodwin's successor and reached an agreement for satisfaction of the remaining debt. When proof of the satisfaction was submitted to CSLB, PCP's suspension was lifted.
PCP also presented a certification of records from CSLB evidencing PCP's license suspension on October 12, 1995; expiration under suspension on January 31, 1996; suspension lifting on March 14, 1996; and renewal on May 3,1996.
In reply, Turner and Universal submitted copies of records from CSLB showing that Barger signed a stipulation for judgment in the Goodwin case on January 22, 1993; judgment was entered in favor of Goodwin International, Inc. and against PCP and Barger, individually, on March 22, 1993; PCP received a renewal of license form from CSLB on November 27, 1995, advising of the license expiration date of January 31, 1996 and stating: "A license cannot be renewed active while under suspension (License suspended for failure to file a Judgment Bond)"; CSLB advised PCP on February 23, 1996 that PCP's renewal application was untimely filed and that PCP's license was still under judgment suspension; CSLB notified PCP on March 15, 1996 that the judgment suspension under section 7071.6 had been lifted, however, the license was still not in good standing because the license had expired; and CSLB informed PCP on April 22, 1996 that PCP's license had not been renewed because PCP had presented a dishonored check.
Based on this evidence, the trial court found that there was no lack of knowledge of license suspension by PCP and PCP's conduct with respect to the maintenance of licensing was not reasonable. Concluding there was no substantial compliance under section 7031, subdivision (d), the court granted summary judgment to Turner and Universal.
In the recent case of ICF Kaiser Engineers, Inc. v. Superior Court (1999) 75 Cal.App.4th 226, 89 Cal.Rptr.2d 88 (Kaiser), a contractor with a suspended license asserted substantial compliance with section 7031 in support of its claim for compensation for services performed. The Court of Appeal noted that the first two prongs of section 7031, subdivision (d), namely prior licensure and reasonable good faith effort to maintain licensure, were not at issue and addressed the third prong: whether the contractor "did not know or reasonably should not have known that he or she was not duly licensed." The undisputed evidence disclosed extensive efforts by the contractor to maintain its license.
The Court of Appeal concluded that the contractor had substantially complied with section 7031 to allow recovery of fees for services, under circumstances where during the period of the contract the contractor had no actual knowledge that its license *763 had been suspended; CSLB did not issue a notice of suspension to put contractor on notice of a licensing problem; CSLB itself was unaware of any problem; and an inquiry to CSLB during the time of suspension would have elicited a response that the contractor's license was in good standing. The Kaiser court noted at page 242, 89 Cal.Rptr.2d 88: "The evidence is clear that ... [contractor's employees] thought they had done everything they were required to do. The [Contractors' State License] Board ... did everything possible to lead ... everyone else at [the contractor] who might arguably be responsible for the licensing process to believe that everything was in order." (Kaiser, supra, 75 Cal.App.4th at p. 242, 89 Cal. Rptr.2d 88.)
In contrast to Kaiser, in the case at bar: (a) PCP was aware in November 1995 that its license was suspended for failure to file a judgment bond and that the deadline date for license renewal was January 31, 1996; (b) PCP knew shortly after February 23, 1996 that a renewal application sent in February 1996 was untimely; and (c) that PCP was advised on April 22, 1996 that its license had not been renewed because PCP's filing fee check had been dishonored. These facts do not suggest that PCP acted reasonably or in good faith to maintain licensure or that PCP did not know or reasonably should not have known that it was not duly licensed, to support a claim of substantial compliance within the meaning of section 7031.
The cases cited by PCP to support its contentions regarding substantial compliance, G.E. Hetrick & Associates, Inc. v. Summit Construction & Maintenance Co. (1992) 11 Cal.App.4th 318, 13 Cal.Rptr.2d 803 and Airftoor Co. of California, Inc. v. Regents of the University of California, supra, 84 Cal.App.3d 1004, 149 Cal.Rptr. 130 are inapposite based upon their individual facts and the different language of section 7031 as it existed at the time those cases were decided. In Hetrick the court found that a license issued to an individual principal of the contractor firm was in effect continuously throughout the period of contracting and performance but that there was a triable issue of fact as to whether the individual was the responsible managing officer of the corporate contractor to a degree sufficient to establish substantial compliance with the contractors' license law. In the present case there is no dispute that neither PCP nor any managing officer maintained a license throughout the period of performance. In Airftoor the court found substantial compliance where the contractor had been licensed for the entire time it performed, with the exception of the last month, and application for renewal had been made before the license expired. In contradistinction, PCP was unlicensed for seven months and application for renewal with a check that was later dishonored was not submitted until the fourth month of the suspension.
The Court of Appeal upheld a dismissal of the claims of a nonlicensed contractor based upon the 1991 version of section 7031 in Construction Financial v. Perlite Plastering Co., supra, 53 Cal.App.4th 170, 61 Cal.Rptr.2d 574. In so doing, the court reiterated the philosophy underlying the statute.
"... there is no basis for applying the doctrine of substantial compliance under the facts of this case. We are not unmindful of the evident harshness of this result. However, the Legislature provided in the 1991 amendment to section 7031 that, except as provided in section 7031(d), section 7031(a) should apply `regardless of the merits of the cause of action' brought by an unlicensed contractor. (Stats.1991, ch. 632, § 1.) ... The Supreme Court has also reasoned that `the deterrent purpose of section 7031 outweighs any harshness in a particular case.' (Hydrotech Systems, Ltd. v. Oasis Waterpark, supra, 52 Cal.3d at p. 997 [277 Cal.Rptr. 517, 803 P.2d 370].) We are bound by this reasoning. (Auto Equity Sales v. Superior Court (1962) 57 Cal.2d 450, 455 [20 Cal.Rptr. 321, 369 P.2d 937].)" (Id. at pp. 184-185, 61 Cal. Rptr.2d 574.)
*764 It is undisputed that PCP's contractor's license was not in effect for seven months during the construction work on the project; PCP had notice of the suspension in November 1995 and for five months after Barger personally became aware of the suspension in January 1996; PCP had failed to timely renew the license after notice of expiration; and when PCP did attempt to renew the license, it sent CSLB a filing fee check that was dishonored. These facts compel the conclusion that PCP could not establish that it "acted reasonably and in good faith to maintain licensure" or that it "did not know or reasonably should not have known" that it was not "licensed," essential elements for a substantial compliance showing under section 7031. Thus, Turner and Universal were entitled to summary judgment as a matter of law.
As a last resort, PCP argues that claims for "noncontractual" costs of delay and added materials and services are not demands for "compensation for performance" of services and, therefore, are not covered by the licensing strictures of section 7031. This argument has little merit. In each of its causes of action in the second amended complaint for quantum meruit, reasonable value of goods and services and unjust enrichment, PCP incorporated the allegations concerning the written contract with Turner and the terms of that contract. Moreover, in each of those claims, PCP alleged that the services for which PCP sought recovery was overseen by Universal on the Jurassic Park job. Under these circumstances, it cannot be seriously disputed that PCP is seeking additional compensation for matters arising out of the contractual relationship.
An argument similar to that raised by PCP was made by an unlicensed contractor in Ranchwood Communities Limited Partnership v. Jim Beat Construction, supra, 49 Cal.App.4th 1397, 57 Cal.Rptr.2d 386. In denying relief for contract-based claims, the Court of Appeal, quoting from Hydrotech, supra, 52 Cal.3d at page 997, 277 Cal.Rptr. 517, 803 P.2d 370, stated: "Regardless of the equities, section 7031 bars all actions, however they are characterized, which effectively seek `compensation' for illegal unlicensed contract work. [Citation.] Thus, an unlicensed contractor cannot recover either for the agreed contract price or for the reasonable value of labor and materials...." (Ranchwood, supra, 49 Cal.App.4th at p. 1409, 57 Cal. Rptr.2d 386, emphasis in original.) In Hydrotech, supra, 52 Cal.3d 988, 277 Cal. Rptr. 517, 803 P.2d 370, the Supreme Court upheld a dismissal of a claim of unlicensed contractor, n
otwithstanding that the contractor's claim was couched in fraud. "... [T]he statute [section 7031] bars an unlicensed contractor's claim for fraud when the primary deceit is a false promise to pay, and the damages primarily consist of, or are measured by, the price or value of the work and materials furnished." (Id. at p. 992, 277 Cal.Rptr. 517, 803 P.2d 370.)
Similarly, the courts have rejected arguments of unlicensed contractors that have attempted to characterize claims for compensation under a contract as reimbursement for lost profits from third parties resulting from a breach of the contract (K & K Services, Inc. v. City of Irwindale (1996) 47 Cal.App.4th 818, 823-824, 54 Cal. Rptr.2d 836), quasi-contract, action to foreclose mechanic's lien, action to enforce vendor's lien (Vallejo Development Co. v. Beck Development Co. (1994) 24 Cal. App.4th 929, 934, 29 Cal.Rptr.2d 669), or action on contract providing for payment in stock (Johnson v. Mattox (1968) 257 Cal.App.2d 714, 718, 65 Cal.Rptr. 185).
The cases cited by PCP are distinguishable and not applicable to the instant proceeding. Gaines v. Eastern Pacific, supra, 136 Cal.App.3d 679, 186 Cal.Rptr. 421 involved a claim by an unlicensed contractor against a subcontractor not for "`compensation for the performance' of acts called for in the contract," but for refusal of the subcontractor to perform work *765 properly and for reimbursement of bills and charges for labor, materials, mechanic's liens, and other demands made by materialmen and other subcontractors. Likewise, American Sheet Metal v. EKAY Engineering Company, Inc. (E.D.Cal.1979) 478 F.Supp. 809 concerned recovery by an unlicensed contractor for the defective work of a subcontractor rather than compensation for services. (Ranchwood Communities Limited Partnership v. Jim Beat Construction Co.. supra, 49 Cal.App.4th at p. 1412, 57 Cal. Rptr.2d 386.) The case of E.G. Ernst, Inc. v. County of Contra Costa (N.D.Cal.1982) 555 F.Supp. 122, allowing an unlicensed contractor to pursue damages caused by delay in work and necessity to perform it out of sequence and in a manner not contemplated by the contract, was decided before the Supreme Court decision in Hydrotech Systems, Ltd. v. Oasis Waterpark, supra, 52 Cal.3d 988, 277 Cal.Rptr. 517, 803 P.2d 370, and, in any event, is a federal court decision on California law that is not binding on this court. (Estate of D'India (1976) 63 Cal.App.3d 942, 948, 134 Cal. Rptr. 165; Bank of Italy etc. v. Bentley (1933) 217 Cal. 644, 653, 20 P.2d 940.)
However alleged or described, the gravamen of PCP's claim is a demand for compensation under its contract on the project. PCP's failure to comply with licensure requirements of section 7031 bars recovery.

C. Attorney Fees
California has adopted the "American" rule of each party bearing its own attorney fees in litigation, unless otherwise provided by contract or statute. (Code Civ. Proc., § 1021;[9]Trope v. Katz (1995) 11 Cal.4th 274, 278, 45 Cal.Rptr.2d 241, 902 P.2d 259; Covenant Mutual Ins. Co. v. Young (1986) 179 Cal.App.3d 318, 321, 225 Cal.Rptr. 861.)
With reference to contracts which contain an attorney's fees clause, Civil Code section 1717, subdivision (a) states in relevant part: "In any action on a contract, where the contract specifically provides that attorney's fees and costs, which are incurred to enforce that contract, shall be awarded to one of the parties or to the prevailing party, then the party who is determined to be the party prevailing on the contract, whether he or she is the party specified in the contract or not, shall be entitled to reasonable attorney's fees in addition to other costs." As to voluntary dismissals pursuant to settlement, Civil Code section 1717, subdivision (b) provides there shall be no prevailing party.
Section 1717 was enacted by the Legislature to ensure mutuality of remedy in the recovery of attorney's fees. (Trope v. Katz, supra, 11 Cal.4th at p. 285, 45 Cal.Rptr.2d 241, 902 P.2d 259.) Thus, where a contract provides that only one party may obtain attorney's fees in litigation, the statute makes the right to such fees reciprocal, such that the "party prevailing on the contract" claim will be entitled to recovery of the fees, "whether he or she is the party specified in the contract or not." (Santisas v. Goodin (1998) 17 Cal.4th 599, 610, 611, 71 Cal.Rptr.2d 830, 951 P.2d 399; International Industries, Inc. v. Olen (1978) 21 Cal.3d 218, 223, 145 Cal.Rptr. 691, 577 P.2d 1031.) Additionally, section 1717 allows attorney's fees to a party who successfully defends an action on a contract containing an attorney's fees clause by establishing the contract's invalidity, unenforceability, or nonexistence. (Santisas v. Goodin, supra, 17 Cal.4th 599, 71 Cal.Rptr.2d 830, 951 P.2d 399; Reynolds Metals Co. v. Alperson (1979) 25 Cal.3d 124, 128-129, 158 Cal.Rptr. 1, 599 P.2d 83.)
Code of Civil Procedure section 1033.5 itemizes those expenses of litigation that *766 may be claimed as recoverable costs by the prevailing party. Included among those expenses are "Attorney fees, when authorized by ... (A) Contract. (B) Statute. (C) Law." (Code Civ. Proc., § 1033.5, subd. (a)(10).) The statute further provides that attorney's fees awarded under Civil Code section 1717 are treated as allowable costs under Code of Civil Procedure section 1032.
The subcontract between PCP and Turner contains the following clauses:
1. "Subcontractor [PCP] shall promptly pay to Turner all costs and reasonable attorney's fees in any legal action in which Turner or the Owner [Universal] prevails, in whole or in part, brought against Subcontractor based on a breach of this Agreement." (Par. 4 of "Standard Provisions", Exh. B to the Agreement.)
2. "If any subcontractor, laborer, materialman or supplier of the Subcontractor ... files or maintains a lien or claim, whether a mechanic's lien or an attested account or otherwise ..., the Subcontractor agrees to indemnify, protect and save harmless Turner and the Owner from and against any and all such liens and claims and actions brought or judgments rendered thereon, and from and against any and all loss, damages, liability, costs and expenses, including legal fees and disbursements, which Turner and/or the Owner may sustain or incur in connection therewith." (Agreement, Article XVIII.)
In denying Turner's motion for attorney's fees, the trial court stated that it believed the attorney's fees clause in the contract between the parties pertained "only to pleadings brought against the subcontractor, not to pleadings brought by the subcontractor or to any pleadings brought in an action in which a subcontractor was sued." The trial court concluded that there was no prevailing party entitled to attorney's fees under either Code of Civil Procedure section 1032, subdivision (a)(4) or Civil Code section 1717. In light of applicable case law interpreting Civil Code section 1717, the attorney's fees provision of the contract was read too narrowly.
In International Industries, Inc. v. Olen, supra, 21 Cal.3d 218, 145 Cal.Rptr. 691, 577 P.2d 1031, the Supreme Court set forth the Legislature's philosophy in passing Civil Code section 1717: "Section 1717 is obviously intended to create a reciprocal right to attorney fees when the contract provides the right to one party but not to the other.... [¶] Enactment of section 1717 commands that equitable consideration must rise over formal ones. Building a reciprocal right to attorney fees into contract, and prohibiting its waiver, the section reflects legislative intent that equitable considerations must prevail over both the bargaining power of the parties and the technical rules of contract construction." (Id. at pp. 223-224, 145 Cal.Rptr. 691, 577 P.2d 1031.) The high court reaffirmed in Santisas v. Goodin, supra, 17 Cal.4th 599, 610, 71 Cal.Rptr.2d 830, 951 P.2d 399, that "[t]he primary purpose of section 1717 is to ensure mutuality of remedy for attorney fee claims under contractual attorney fee provisions."
In Hunt v. Smyth (1972) 25 Cal.App.3d 807, 101 Cal.Rptr. 4, plaintiffs were makers of a promissory note providing that if suit be instituted on the note, maker would pay attorney's fees. Upon judgment being rendered for defendants in plaintiffs' action to enjoin foreclosure of the property securing the note, plaintiffs objected to an award of attorney's fees. Plaintiffs contended that since the action was not instituted to collect on the note, the attorney's fees clause was not applicable. In overruling the objection the court stated: "It is generally recognized that a provision for attorney's fees will be applicable even though the action is instigated by the obligor rather than the obligee. `Attorney's fees may be recovered where the adverse claim is made by the mortgagor or grantor...."' (Id. at p. 832, 101 Cal.Rptr. 4; see Techow v. Pollack (1952) 111 Cal. App.2d 556, 558, 244 P.2d 915; Hewlett v. *767 Evans (1922) 56 Cal.App. 344, 347, 205 P. 492.)[10]
In Boyd v. Oscar Fisher Co. (1989) 210 Cal.App.3d 368, 258 Cal.Rptr. 473, an attorney fees clause was contained in invoices sent by a manufacturer to a dealer but not in the distributorship or franchise agreement between the parties. In suit by dealer for unjustifiable termination of dealership agreement which included a cross-claim by the manufacturer for unpaid invoices, court awarded the manufacturer attorney's fees. Responding to dealer's argument that attorney's fees should be limited to attorney's collection fee efforts on the invoices, the court stated that Civil Code section 1717 should not be read so restrictively, as attorney's fees provision should apply to the entire contractual relationship.[11]
Under the trial court's interpretation of the Agreement, to wit, that the attorney's fees clause applies only to actions against PCP, Turner would be able to recover attorney's fees if it successfully sued on a complaint against PCP but not if it prevailed on a cross-claim filed in an action instituted by PCP. Conversely, PCP would not be able to recover attorney's fees as a victorious plaintiff, but only as a successful cross-complainant in an action commenced against it by Turner. Such results would undermine the bilateral nature and required liberal interpretation of Civil Code section 1717. (Boyd v. Oscar Fisher Co., supra, 210 Cal.App.3d at p. 380, 258 Cal. Rptr. 473.) "Section 1717 is obviously intended to create a reciprocal right to attorney fees when the contract provides the right to one party but not to the other." (International Industries, Inc. v. Olen, supra, 21 Cal.3d at p. 223, 145 Cal.Rptr. 691, 577 P.2d 1031.)
Since under Civil Code section 1717, an attorney's fee provision will be given effect whether the action is commenced by the obligor or the obligee (Hunt v. Smyth, supra, 25 Cal.App.3d 807, 101 Cal.Rptr. 4), there is no reason to differentiate between an action brought by the subcontractor or against the subcontractor. In either case, the prevailing party is entitled to recover attorney's fees under the contractual provision and Civil Code section 1717.
This litigation was commenced by PCP's suppliers and subcontractors filing suits for the foreclosure of mechanic's liens relating to work performed on the project. In response to these complaints, Turner filed a cross-complaint against PCP for indemnity. Under the indemnity provision of the Agreement cited above, Turner would be entitled to recover its attorney's fees expended in defense of those claims.
Following the granting of summary judgment in favor of Turner and Universal on PCP's cross-complaint, Turner dismissed without prejudice its own cross-complaint for indemnity against PCP. According to the declaration of counsel for Turner, the cross-complaint against PCP was dismissed because of the time and expense that would be involved in prosecution of its indemnity claims, given that it had contributed only $20,000 to the settlement with PCP's suppliers and had *768 already obtained a successful result in the defense of the PCP cross-complaint.
Code of Civil Procedure section 1032,[12] dealing with the recovery of costs,[13] defines the prevailing party as (a) a party with net monetary recovery; (b) a defendant[14] in whose favor a dismissal is entered; (c) a defendant where neither plaintiff nor defendant obtains relief; and (d) a defendant as against those plaintiffs who do not recover any relief against that defendant. Turner claims that it is entitled to attorney's fees as an element of costs, under Code of Civil Procedure sections 1032, subdivision (a) and 1033.5, subdivision (a)(10)(A), because on the cross-complaint of PCP, Turner was a cross-defendant where neither cross-complainant nor cross-defendant obtained relief and a cross-defendant as against a cross-complainant who did not recover any relief. The trial court found that since Turner had dismissed its own cross-complaint against PCP, this case involved a situation other than the four possibilities enumerated in Code of Civil Procedure section 1032, subdivision (a). The court concluded that when both adverse parties fall within the definition of prevailing party, the statute did not mandate "a prevailing party" and did not require an award of attorney's fees.[15]
In Hsu v. Abbara (1995) 9 Cal.4th 863, 39 Cal.Rptr.2d 824, 891 P.2d 804, defendants' motion for judgment was granted after plaintiffs rested their case for specific performance of a real estate purchase contract containing an attorney's fee provision. The court, however, denied defendants' request for attorney's fees under Civil Code section 1717. In the Supreme Court, plaintiffs argued that the trial court had broad discretion to deny attorney's fees to an ostensibly prevailing party based on considerations of equity. In reversing the judgment denying an award of attorney's fees, the Supreme Court stated: "... It is consistent with the underlying purposes of the statuteto achieve mutuality of remedyand it harmonizes section 1717 internally by allowing those parties whose litigation success is not fairly disputable to claim attorney fees as a matter of right, while reserving for the trial court a measure of discretion to find no prevailing party when the results are mixed. [¶] Accordingly, we hold that in deciding whether there is a `party prevailing on the contract,' the trial court is to compare the relief awarded on the contract claim or *769 claims with the parties' demands on those same claims and their litigation objectives as disclosed by the pleadings, trial briefs, opening statements, and similar sources. The prevailing party determination is to be made only upon final resolution of the contract claims and only by `a comparison of the extent to which each party ha[s]succeeded and failed to succeed in its contentions.' (Bank of Idaho v. Pine Avenue Associates (1982) 137 Cal.App.3d 5, 15 [186 Cal.Rptr. 695].) [¶] ... We agree that in determining litigation success, courts should respect substance rather than form, and to this extent should be guided by 'equitable considerations.' For example, a party who is denied direct relief on a claim may nonetheless be found to be a prevailing party if it is clear that the party has otherwise achieved its main litigation objective. [Citation.]" (Id. at pp. 876-877, 39 Cal.Rptr.2d 824, 891 P.2d 804, emphasis in original.)[16] Finding that the judgment was a "`simple, unqualified win'" (9 Cal.4th at p. 876, 39 Cal.Rptr.2d 824, 891 P.2d 804) for defendants, the Supreme Court concluded that the trial court had no discretion to deny defendants attorney's fees under Civil Code section 1717.[17]
In the second amended cross-complaint, PCP sought damages against Turner and Universal of $2,000,000. By succeeding in having summary judgment granted on the cross-complaint, there can be no doubt that Turner obtained a "simple, unqualified win." After settling with mechanic's lien claimants for $20,000,[18] Turner dismissed its own cross-complaint for indemnity against PCP because of the time and expense that would be incurred in pursuing the indemnity claims further.[19] Comparing the relief awarded on the contract claims with the parties' demands and litigation objectives as disclosed by the pleadings, as required by Hsu v. Abbara, supra, we must conclude that Turner greatly succeeded in achieving its litigation objectives of defeating PCP's claims, while PCP clearly failed to accomplish its desired goals. One could not contend that the results are mixed. Under these circumstances, Turner should have been declared the prevailing party within the meaning of section 1717, entitling it to the recovery of attorney's fees. The trial court's refusal to award attorney fees was an abuse of discretion.

DISPOSITION
The summary judgment is affirmed; the order denying attorney's fees is reversed. The case is remanded to the trial court for a determination as to the amount of attorney's fees. Turner and Universal to recover costs on appeal.
CHARLES S. VOGEL, P.J., and EPSTEIN, J., concur.
NOTES
[*]   Judge of the Los Angeles Superior Court, assigned by the Chief Justice pursuant to article VI, section 6 of the California Constitution.
[1]  Los Angeles Superior Court case number BC 145992.
[2]  Los Angeles Superior Court case number BC 152029.
[3]  In its second amended cross-complaint, PCP alleged causes of action for breach of contract, quantum meruit, reasonable value of goods and services, unjust enrichment, foreclosure of stop notice, interference with prospective economic advantage, and interference with contractual relation.
[4]  Unless otherwise indicated all statutory references are to the Business and Professions Code.
[5]  PCP claims that the suspension was "not final."
[6]  Section 7031 states, in relevant part, as follows:

"(a) Except as provided in subdivision (d), no person engaged in the business or acting in the capacity of a contractor, may bring or maintain any action, or recover in law or equity in any action, in any court of this state for the collection of compensation for the performance of any act or contract for which a license is required by this chapter without alleging that he or she was a duly licensed contractor at all times during the performance of that act or contract, regardless of the merits of the cause of action brought by the person, except that this prohibition shall not apply to contractors who are each individually licensed under this chapter but who fail to comply with Section 7029."
[7]  Stats. 1991, ch. 632 provided:

"... (d) The judicial doctrine of substantial compliance shall not apply to this section, except that a court may determine that there has been substantial compliance with licensure requirements, for purposes of this section, if it is shown at an evidentiary hearing that the person was a duly licensed contractor during any portion of the 90 days immediately preceding the performance of the act or contract for which compensation is sought, that the person's category of licensure would have authorized the performance of that act or contract, and that noncompliance with the licensure requirement was the result of (1) inadvertent clerical error, or (2) other error or delay not caused by the negligence of the person. Subdivision (b) of Section 143 does not apply to contractors subject to this subdivision. [¶] (e) The exceptions to the prohibition against the application of the judicial doctrine of substantial compliance found in subdivision (d) shall have no retroactive effect. These exceptions to that prohibition shall only apply to an action or arbitration proceeding, at law or in equity, that is commenced after the effective date of this section."
[8]  Section 7071.6, subdivision (e) stated: "Notwithstanding any other provision of law, the licensee shall notify the registrar in writing of any entered and unsatisfied judgments within 90 days from the date of the judgment. [¶] If the licensee fails to notify the registrar in writing within 90 days, the license shall be automatically suspended and the licensee shall automatically be prohibited from serving as the responsible managing officer, responsible managing partner, or responsible managing employee for any other licensee from the date that the registrar is informed, or is made aware of the unsatisfied judgment. The suspension of the license and prohibition against serving as the responsible managing officer, responsible managing partner, or responsible managing employee for any other licensee shall not be removed until proof of satisfaction of judgment is submitted to the registrar...."
[9]  Code of Civil Procedure section 1021 states: "Except as attorney's fees are specifically provided for by statute, the measure and mode of compensation of attorneys and counselors at law is left to the agreement, express or implied, of the parties; but parties to actions or proceedings are entitled to their costs, as hereinafter provided."
[10]  See also Covenant Mutual Ins. Co. v. Young, supra, 179 Cal.App.3d 318, 323, 225 Cal.Rptr. 861: "... assume a lease agreement provides the tenant must pay the landlord's attorney fees if the landlord sues him successfully under the lease. But assume also the lease agreement fails to mention the tenant's right to recover attorney fees if he wins. The Legislature has intervened to effectively rewrite this lease. No matter what the agreement says section 1717 allows the tenant to recover his attorney fees should he rather than the landlord win."
[11]  The court in Boyd referred to the relevant language of Civil Code section 1717: "Where a contract provides for attorney fees ... such provision shall be construed as applying to the entire contract...." (Boyd v. Oscar Fisher Co., supra, 210 Cal.App.3d at p. 380, 258 Cal.Rptr. 473; see also Myers Building Industries, Ltd. v. Interface Technology, Inc. (1993) 13 Cal.App.4th 949, 17 Cal.Rptr.2d 242.)
[12]  Code of Civil Procedure section 1032, subdivision (a)(4) states:

"(4) `Prevailing party' includes the party with a net monetary recovery, a defendant in whose favor a dismissal is entered, a defendant where neither plaintiff nor defendant obtains any relief, and a defendant as against those plaintiffs who do not recover any relief against that defendant. When any party recovers other than monetary relief and in situations other than as specified, the `prevailing party' shall be as determined by the court, and under those circumstances, the court, in its discretion, may allow costs or not and, if allowed may apportion costs between the parties on the same or adverse sides pursuant to rules adopted under Section 1034."
[13]  Although helpful in the analysis of who is the prevailing party under Civil Code section 1717, the determination of the prevailing party for the purposes of costs is not controlling as to the issue of prevailing party for the entitlement of attorney's fees. (Sears v. Baccaglio (1998) 60 Cal.App.4th 1136, 70 Cal. Rptr.2d 769; McLarand, Vasquez. & Partners, Inc. v. Downey Savings & Loan Assn. (1991) 231 Cal.App.3d 1450, 1456, 282 Cal.Rptr. 828; Nasser v. Superior Court (1984) 156 Cal. App.3d at 52, 61, 202 Cal.Rptr. 552.)
[14]  Code of Civil Procedure section 1032, subdivision (a) defines defendant to include cross-defendant, and plaintiff to include cross-complainant.
[15]  The court stated its conclusion: "Because Turner was unsuccessful on its cross-complaint and because Turner prevailed against Pacific [PCP] based on technicality, the lack of a contractor's license, the court determines there is no prevailing party for the purposes of either Code of Civil Procedure section 1032(a)(4) or Civil Code section 1717. As to CCP section 1032(a)(4), the court could determine that one party or the other is prevailing but refuse to award costs to that party."
[16]  With respect to mutual cross-complaints in a case, the court noted: "When there are cross-actions on a contract containing an attorney fees provision, and no relief is awarded in either action, a trial court is not obligated to find that there is no party prevailing on the contract for purposes of section 1717. If the court concludes that the defendant's cross-action against the plaintiff was essentially defensive in nature, it may properly find the defendant to be the party prevailing on the contract." (Hsu v. Abbara, supra, 9 Cal.4th at p. 875, fn. 10, 39 Cal.Rptr.2d 824, 891 P.2d 804.)
[17]  See also Sears v. Baccaglio, supra, 60 Cal. App.4th at page 1155, 70 Cal.Rptr.2d 769: "While the trial court cannot arbitrarily deny fees to a less-than-sympathelic party, it remains free to consider all factors which may reasonably be considered to indicate success in the litigation. We agree the court may not abuse its discretion
[18]  The $20,000 payment represents only one percent of PCP's claim and approximately two percent of the construction contract price.
[19]  The law does not require a party to spend funds to maintain and continue unnecessary litigation that has become moot or pointless. (International Industries, Inc. v. Olen, supra, 21 Cal.3d at p. 224, 145 Cal.Rptr. 691, 577 P.2d 1031; see also Villa v. Cole (1992) 4 Cal.App.4th 1327, 6 Cal.Rptr.2d 644.)
