
38 Cal.App.3d 59 (1974)
112 Cal. Rptr. 910
T.E.D. BEARING COMPANY, Plaintiff and Appellant,
v.
WALTER E. HELLER & COMPANY OF CALIFORNIA et al., Defendants and Respondents.
Docket No. 42112.
Court of Appeals of California, Second District, Division Four.
March 25, 1974.
*60 COUNSEL
Frank Gafkowski, Jr., and Daniel W. Gage for Plaintiff and Appellant.
Kaplan, Livingston, Goodwin, Berkowitz & Selvin, Charles M. Levy, Jones & Bednar and Clayton Straube for Defendants and Respondents.
*61 OPINION
KINGSLEY, J.
This appeal is the second of two appeals resulting from an amended complaint filed on behalf of T.E.D. Bearing Company, plaintiff (hereinafter T.E.D.) against defendants Walter E. Heller & Company (hereinafter Heller) and Lawrence Warehouse Company (hereinafter Lawrence).
This complaint alleged various counts. After the court sustained demurrers, an order of dismissal was granted by the court in favor of Lawrence, and T.E.D. entered a stipulation for an order of dismissal, allowing Heller $26 in trial costs.[1] On appeal, the trial court's determination was upheld. The Court of Appeal's remittitur was filed, and it provided that "It is ordered, adjudged and decreed by the court that the judgment is affirmed. Respondents to recover costs." Heller's and Lawrence's memoranda of costs included attorney's fees "from inception of matter to date." T.E.D. filed a motion to tax costs and the trial court allowed costs as prayed for in Heller's and Lawrence's memoranda. Plaintiff T.E.D. appeals.[2]
Plaintiff's first argument is that, where attorneys' fees are predicated on contract, recovery must be predicated on that contract and not be given as costs under Code of Civil Procedure section 1021, and the fees must be alleged and demanded in the complaint. Section 1021 reads as follows: "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 costs and disbursements, as hereinafter provided."
(1) Plaintiff is correct in contending that attorneys' fees which are based on contract rather than on statute cannot be taxed as costs under section 1021 of the Code of Civil Procedure (Genis v. Krasne (1956) 47 Cal.2d 241 [302 P.2d 289]; City Investment Co. v. Pringle (1920) 49 Cal. App. 353 [193 P. 504]), and that contracts providing that the aggrieved party may recover attorneys' fees, which are recoverable as special damages and not as costs, must be alleged and demanded in the complaint. (City Investment Co. v. Pringle, supra, at p. 355.) (2) The rule is "that where attorneys' fees are allowable solely [italics added] by virtue of contract they cannot [italics in original] be recovered by merely including them in the *62 memorandum of costs." (Genis v. Krasne, supra, 47 Cal.2d 241, at p. 246, quoting Pringle.)
But where attorneys' fees are awarded pursuant to a statute rather than by contract, they are costs. (System Inv. Corp. v. Union Bank (1971) 21 Cal. App.3d 137, 162 [98 Cal. Rptr. 735].)[3] (3) Therefore, the problem before this court is to determine whether Heller and Lawrence were entitled to attorneys' fees by virtue of a contract, such that they could not be awarded attorneys' fees as "costs," or whether Heller and Lawrence were entitled to attorneys' fees by virtue of a statute, such that the trial court could make its award as part of a memorandum of costs, even though there was no special demand in the complaint for attorneys' fees.
It is clear that Heller and Lawrence predicated their claim to attorneys' fees in part on contract; that is, they originally relied on certain language in each of their agreements with T.E.D. which required T.E.D. to pay any attorneys' fees incurred by defendants Heller and Lawrence.[4] Had we had nothing more before us than these contracts, respondents could not properly have recovered attorneys' fees as costs; respondents' rights would then be based on contract and they would have had to specially plead and prove the attorneys' fees, which respondents failed to do.
*63 However, section 1717 of the Civil Code provides as follows: "In any action on a contract, where such contract specifically provides that attorney's fees and costs, which are incurred to enforce the provisions of such contract, shall be awarded to one of the parties, the prevailing party, whether he is the party specified in the contract or not, shall be entitled to reasonable attorney's fees in addition to costs and necessary disbursements.
"Attorney's fees provided for by this section shall not be subject to waiver by the parties to any contract which is entered into after the effective date of this section. Any provision in any such contract which provides for a waiver of attorney's fees is void.
"As used in this section `prevailing party' means the party in whose favor final judgment is rendered."
The primary purpose of Civil Code section 1717 is to transfer a unilateral contractual contract right to attorneys' fees into a reciprocal provision giving the right to recover to either party. (Associated Convalescent Enterprises v. Carl Marks & Co., Inc. (1973) 33 Cal. App.3d 116 [108 Cal. Rptr. 782].) In the agreements before us the contracts provided that attorneys' fees and costs will be awarded to only one of each of the contracting parties, Lawrence in one contract, and Heller in the other contract, and not to T.E.D., thus bringing those unilateral contracts for attorneys' fees within the reciprocal provisions of Civil Code section 1717. Accordingly, respondents Heller and Lawrence had rights to attorneys' fees by virtue of statute (§ 1717), as well as by virtue of contract.
The legal situation before us is, perhaps, unique in the sense that Civil Code section 1717 has been used in the past to benefit the prevailing party in cases where the prevailing party was not also the party to be benefited by the unilateral contractual provisions granting attorneys' fees. That is, the cases we have found have generally dealt with the granting of attorneys' fees to the prevailing party, under Civil Code section 1717, where the contract had granted attorneys' fees solely to the other contracting party who lost the law suit. But the language of Civil Code section 1717 is not so limited as this. The statute says that attorneys' fees shall be awarded to "the prevailing party, whether he is the party specified in the contract or not." The language of Civil Code section 1717 does not say that attorney fees will be awarded to the party not benefited by the provision granting attorneys' fees if that party prevails. The language is broader than that, and it awards attorneys' fees to "the prevailing party" whether he is the one specified in the contract or whether he was the one to be disadvantaged by the contract. Therefore, in the case before us, while Heller and Lawrence had rights to attorneys' fees by contract, they also had rights to attorneys' *64 fees by statute  that is, they had rights as the "prevailing" parties under Civil Code section 1717.
Case law is consistent with this view. It has been judicially determined that the "prevailing party's" rights to attorneys' fees under section 1717 is a statutory right.[5] (Associated Convalescent Enterprises v. Carl Marks & Co., Inc., supra, 33 Cal. App.3d 116, 120.) It has also been judicially determined that attorneys' fees awarded under Civil Code section 1717 are "costs" similar to the situation under other statutes which provide for attorneys' fees in litigation and refer to them as costs. (System Inv. Corp. v. Union Bank, supra, 21 Cal. App.3d 137, 169.) As such, the trial court properly could grant attorneys' fees as "costs" to the "prevailing" parties, Heller and Lawrence, that is, to the parties "in whose favor final judgment is rendered."
T.E.D. argues that Heller and Lawrence waived their rights to attorneys' fees. The rule of law requiring that attorneys' fees be specially averred where they are special damages as a function of contract (Hunt v. Smyth (1972) 25 Cal. App.3d 807 [101 Cal. Rptr. 4]) has no application where an award of attorneys' fees is statutory. In any event, it has been held that, where a party's right to attorneys' fees rests on section 1717, the fact that the entire contract was before the court in the original action is a sufficient "pleading" to authorize an attorneys' fees award. (San Luis Obispo Bay Properties, Inc. v. Pacific Gas & Elec. Co. (1972) 28 Cal. App.3d 556, 570-573 [104 Cal. Rptr. 733].) That was the case here. All of the pertinent contractual documents were included in the complaint and amended complaint filed by T.E.D., and were relied on by it as the foundation for its action. T.E.D. is in no position, at this stage, to deny that the contract provision was incorporated in the contracts between the parties, thus triggering the application of section 1717.
T.E.D. contends that the superior court had no jurisdiction to grant attorneys' fees on appeal, arguing that, for a superior court to hear an application for attorneys' fees on appeal after judgment has become final, jurisdiction must be conferred on it by the appellate court or by statute. T.E.D. cites American City Bank v. Zetlen (1969) 272 Cal. App.2d 65 [76 Cal. Rptr. 898], for this proposition. In Zetlen, the Court of Appeal affirmed the trial court's denial of plaintiff's motion for attorneys' fees on the ground that there was no request by the appellant for attorneys' fees on appeal, and because there was no provision by the appellate court in its decision or in its remittitur. T.E.D. argues that, in the case at bench, there also was no request for attorneys' fees, and neither the opinion filed by the appellate *65 court nor the remittitur provided for attorneys' fees. However, the rule of Zetlen does not apply here. The original appeal in Zetlen was decided prior to adoption of Civil Code section 1717, and, although the second appeal was decided after the effective date of Civil Code section 1717, the Zetlen case made no mention of section 1717. The Zetlen Court of Appeal decided that the superior court had no jurisdiction to grant attorneys' fees on appeal where no authority was conferred by the superior court, in a case where the party was entitled to attorneys' fees by virtue of a contractual provision in a promissory note. Zetlen distinguished Painter v. Estate of Painter (1889) 78 Cal. 625 [21 P. 433], on the grounds that, in Painter, the right to attorneys' fees was statutory. In the recent case of Roberts v. Brian (1973) 30 Cal. App.3d 427 [106 Cal. Rptr. 360], the appellant also cited Zetlen in support of his position that the trial court was without power to award attorneys' fees for services rendered on appeal, where the Supreme Court gave no directions to award attorneys' fees. The Roberts v. Brian court held that Zetlen did not dictate reversal because, in Roberts v. Brian as in Painter, the attorneys' fees were statutory and properly left to the trial court (Roberts v. Brian, supra, 30 Cal. App.3d 427, at p. 429), although there were additional reasons why the trial court had jurisdiction to make an award of attorneys' fees for services rendered on appeal in Roberts.[6] In Roberts, as in the case before us, the right to attorneys' fees is statutory and, therefore, the trial court had jurisdiction to make an award. The Roberts court said that Roberts "stood as much in need of an attorney in the appellate as in the lower court." That reasoning applies to Heller and Lawrence as well, and the superior court below had jurisdiction to award attorneys' fees notwithstanding the absence of such a provision in the remittitur. Attorneys' fees should be allowed Heller and Lawrence in the instant appeal.[7]
The order is affirmed; our remittitur will carry with it authority for the trial court to award to respondents on this appeal, reasonable attorneys' fees in addition to the usual costs on appeal.
Jefferson, Acting P.J., and Dunn, J., concurred.
NOTES
[1]  It is not contended that that stipulation barred Heller's present claim if otherwise proper.
[2]  No contention is made on this appeal that the amounts awarded are excessive if jurisdiction existed in the trial court to make any award at all. No issue as to the amount of the fees was tendered in the trial court.
[3]  System Inv. Corp. v. Union Bank, reads as follows at page 162: "It is to be noted that in the present case, the attorneys' fees were awarded pursuant to statute (Civ. Code, § 1717). Other statutes which provide for attorneys' fees in litigation refer to attorneys' fees as costs. For example, section 836 of the Code of Civil Procedure, which relates to actions for damages for libel, provides that if the defendant recovers judgment he shall be allowed one hundred dollars `to cover counsel fees in addition to other costs'; section 796 of the Code of Civil Procedure, which relates to actions for partition of property, provides for recovery of `the costs of partition, including reasonable counsel fees'; and section 1255a of the Code of Civil Procedure, which relates to eminent domain proceedings, provides that recoverable costs include reasonable attorneys' fees."
[4]  The agreement with Heller states: "All sums so paid or incurred by Factor [all expenses of storing, warehousing, insuring, selling, handling, and shipping Borrower's inventory, and any and all excise, property, sales taxes, etc.] for any of the foregoing and any and all other sums for which Borrower may become liable hereunder and all costs and expenses (including attorneys' fees and court costs) which Factor may incur in creating, enforcing or protecting its lien on all rights or remedies under this or any other agreement or in respect of any of the transactions to be had thereunder, until paid by Borrower to Factor with interest at the rate aforesaid shall be so much additional indebtedness owing by Borrower to Factor...." (Italics supplied by appellant.)

A declaration by A.F. Norris, an officer of Lawrence recites: "Said field warehouse storage agreement provides that the said T.E.D. Bearing Company, therein referred to as depositor, agrees to pay all reasonable expenses including attorney's fees incurred by LAWRENCE WAREHOUSE COMPANY incident to conducting any warehouse under said agreement and in connection with any litigation in which LAWRENCE WAREHOUSE COMPANY is a party."
The facts so recited are not denied by T.E.D.
[5]  In Associated Convalescent Enterprises, supra, the "prevailing party" was not the party to be originally benefited by a unilateral provision for attorneys' fees.
[6]  See Roberts v. Brian, supra, at pages 429 and 430. In Zetlen the motion was made in the trial court for counsel fees on appeal after the judgment became final.
[7]  Although unnecessary under our holding in this case, we have, out of an excess of caution, included an express direction to that effect in our judgment.
