
61 Cal.App.4th 561 (1998)
ALBERT E. MEAD et al., Plaintiffs and Appellants,
v.
SANWA BANK CALIFORNIA, Defendant and Respondent.
Docket Nos. E018978, E019611.
Court of Appeals of California, Fourth District, Division Two.
February 11, 1998.
*563 COUNSEL
Albert E. Mead, Jr., for Plaintiffs and Appellants.
White & Case, John A. Sturgeon and John D. Early for Defendant and Respondent.
[Opinion certified for partial publication.[*]]
OPINION
McKINSTER, Acting P.J.
The owners of a parcel of bare land signed a long-term ground lease with a developer, who planned to improve the property with a commercial building. To facilitate that construction, the owners executed a deed of trust in favor of the developer's construction lender. Ultimately, the developer defaulted on the construction loan and the assignee of the lender foreclosed on the owner's fee interest.
*564 The owners sued the developer, the lender, and the lender's assignee for damages and other relief. As to the lender, their theories primarily relied upon their assertion that the deed of trust was, in substance, a surety agreement. Their action against the lender was dismissed when they declined to amend their complaint after a demurrer was sustained to each count alleged. The owners appeal from the order of dismissal and from the postjudgment order awarding attorney's fees to the lender.
While we agree that the owners sufficiently pleaded that they were sureties rather than principal obligors, the owners did not ultimately demonstrate that the trial court erred in sustaining the demurrers and awarding attorney's fees. Accordingly, we affirm.

STANDARDS OF REVIEW
(1a) In evaluating an order sustaining a demurrer to a pleading, we give the pleading a reasonable interpretation by reading it as a whole and all of its parts in their context. (Moore v. Regents of University of California (1990) 51 Cal.3d 120, 125 [271 Cal. Rptr. 146, 793 P.2d 479, 16 A.L.R.5th 903].) We assume the truth of all material facts which have been properly pleaded, of facts which may be inferred from those expressly pleaded, and of any materials facts of which judicial notice has been requested and may be taken. (Crowley v. Katleman (1994) 8 Cal.4th 666, 672 [34 Cal. Rptr.2d 386, 881 P.2d 1083]; Marshall v. Gibson, Dunn & Crutcher (1995) 37 Cal. App.4th 1397, 1403 [44 Cal. Rptr.2d 339].)
When considering the legal effect of those facts, we disregard any erroneous or confusing labels employed by the plaintiff. (Saunders v. Cariss (1990) 224 Cal. App.3d 905, 908 [274 Cal. Rptr. 186].) A complaint is sufficient if it alleges facts which state a cause of action under any possible legal theory. (Aubry v. Tri-City Hospital Dist. (1992) 2 Cal.4th 962, 967 [9 Cal. Rptr.2d 92, 831 P.2d 317].) However, because it is not a reviewing court's role to construct theories or arguments which would undermine the judgment (People v. Stanley (1995) 10 Cal.4th 764, 793 [42 Cal. Rptr.2d 543, 897 P.2d 481]), we consider only those theories advanced in the appellant's briefs.

THE ALLEGATIONS OF THE COMPLAINT
The operative pleading is the first amended complaint, filed in April of 1996. It alleges the following facts.
Albert E. Mead and Barbara Duque Mead are the trustees of the Albert E. Mead and Barbara Duque Mead Revocable Inter Vivos Trust. (The complaint refers to the individuals and the trust collectively as the "Meads.") *565 The Meads bought an undeveloped parcel of property from Theodore B. Zwicker in 1988. Simultaneously, the Meads executed a 30-year ground lease to Cooley Executive Plaza II (Cooley), a limited partnership of which Zwicker was the general partner. The lease required the Meads to "`subordinate' [their] interest in the Property to an anticipated construction lender's deed of trust" by executing the deed of trust, but not the promissory note which the deed of trust would secure.
In 1989, Zwicker arranged for Sanwa Bank California to provide the construction financing. The construction loan agreement and the promissory note for $1,020,000 were signed solely by Cooley. However, the deed of trust securing the performance of the obligations of Cooley under the loan agreement and the promissory note was executed by both Cooley and the Meads, and encumbered both Cooley's leasehold interest and the Meads' fee interest in the property. The deed of trust identifies the Meads and Cooley jointly as "Trustor" and imposes a variety of obligations upon the Trustor. On the other hand, it provides that the Meads assumed "no personal liability for the performance of the obligations of Cooley under this Deed of Trust" and could not be held personally liable by Sanwa.
Cooley defaulted on its obligations under both the ground lease and the promissory note in 1993. In August of that year, Sanwa commenced nonjudicial foreclosure proceedings by recording a notice of default. The Meads urged Sanwa to either seek the appointment of a receiver or allow the Meads to assume Cooley's obligations. Sanwa assured the Meads that a receiver would be appointed. The Meads also filed an unlawful detainer action to remove Cooley from possession of the property. The action was dismissed in 1994, after Sanwa made the dismissal a condition of a forbearance agreement by which Sanwa agreed to postpone publication of its notice of sale.
In August of 1995, the last of numerous extensions of the maturity date of the promissory note expired, and the note became due. Sanwa started a new foreclosure proceeding, but assured the Meads that it would proceed only against Cooley's leasehold interest. Sometime thereafter, Sanwa reversed itself and informed the Meads that it intended to foreclose on its security interest in the fee as well as the leasehold.
In December of 1995, the Meads formally demanded that Sanwa exhaust all remedies against Cooley prior to exercising any right under the deed of trust against the Meads. In particular, they demanded that Sanwa terminate the pending foreclosure proceedings as to the Meads' fee interest in the property.
Further allegations will be discussed in connection with individual counts.


*566 PROCEDURAL BACKGROUND
Also in December of 1995, the Meads filed suit against Sanwa, Zwicker, and Cooley. A demurrer by Sanwa was sustained with leave to amend. Thereafter, the Meads filed their first amended complaint. As to Sanwa, it asserts claims for damages on the basis of: breach of fiduciary duty (first count); breach of the covenant of good faith and fair dealing (second count); fraud (third count); negligent misrepresentation (fourth count); waste (fifth count); rescission and restitution (sixth count); negligence (seventh count); and breach of written contract (eighth count).
Sanwa again demurred: generally as to all counts, and specially as to the misrepresentation counts. The trial court sustained the demurrers to all counts, but granted leave to amend the third, fourth, fifth and sixth. When the Meads declined to amend, the complaint was dismissed and judgment was entered in favor of Sanwa.
Thereafter, Sanwa moved for attorney's fees pursuant to Civil Code section 1717. Over the Meads' opposition, the trial court granted the motion and awarded fees and costs in the sum of $45,870.29.
The Meads separately filed appeals from the order of dismissal and from the order granting the attorney's fees. We consolidated the two appeals for decision.

CONTENTIONS
Generally, the Meads contend that they are sureties rather than principal obligors, and they were denied their statutory rights as sureties.[1] More specifically, they argue that each count of the complaint states sufficient facts to constitute a cause of action. In addition, they contend that they were deprived of a fair hearing below on the demurrer, and that the trial court erred in awarding attorney's fees in any amount.

DISCUSSION

A. The Complaint Sufficiently Alleges That the Meads Are Sureties.

(2) "The suretyship relation ... arises where two persons are under obligation to the same obligee, who is entitled to but one performance, as *567 between the two who are bound, and one of them should ultimately bear the burden of the obligation. The obligor ultimately responsible for the debt is the principal and the other is the surety." (Everts v. Matteson (1942) 21 Cal.2d 437, 447 [132 P.2d 476].)
A suretyship may result from different types of promises: "A surety ... is one who promises to answer for the debt, default, or miscarriage of another, or hypothecates property as security therefor." (Civ. Code, § 2787.) Those promises may be made in an express agreement or may be implied by law. (See, e.g., Braun v. Crew (1920) 183 Cal. 728, 731 [192 P. 531] [mortgagor and maker of secured note becomes surety when the property is sold and buyer assumes the debt].)
(3a) Because the parties focus primarily upon whether the Meads are sureties or principal obligors, we address that issue first. Have the Meads adequately pleaded the existence of a suretyship relationship between themselves and Sanwa?
The Meads repeatedly allege that they were the sureties of Cooley's debt, not principal obligors. Sanwa dismisses those allegations on the ground that unsupported factual conclusions are disregarded when ruling on a demurrer. (Moore v. Regents of University of California, supra, 51 Cal.3d at p. 125.) However, the Meads pleaded a variety of facts to support that conclusion, including the following: Only Cooley signed the note; the deed of trust recites that it secures the performance by Cooley of his obligations under the construction loan agreement and the note; the certificate of authority given by the Meads to Sanwa reiterates that the deed of trust is given to secure repayment of Cooley's obligations; the deed of trust recites that the Meads shall have no personal liability for the payment of Cooley's obligations; Sanwa excluded the Meads from negotiations concerning both the initial terms of the loan and its subsequent extensions; Sanwa extended the loan three times without the Meads' knowledge or consent; and Sanwa considered the Meads to be third parties rather than borrowers or principal obligors.
Sanwa challenges the sufficiency of those factual allegations by arguing that they are contradicted and thus superseded by the terms of the deed of trust appended to the complaint, and that in any event the facts alleged by the Meads are insufficient as a matter of law to establish that they were only sureties. It is mistaken on both grounds.

1. The Recital in the Deed of Trust That the Meads Are Trustors Does Not Conflict With Allegations in the Body of the Complaint That They Are Sureties.

(1b) For purposes of a demurrer, we accept as true both facts alleged in the text of the complaint and facts appearing in exhibits attached to it. If the *568 facts appearing in the attached exhibit contradict those expressly pleaded, those in the exhibit are given precedence. (Dodd v. Citizens Bank of Costa Mesa (1990) 222 Cal. App.3d 1624, 1626-1627 [272 Cal. Rptr. 623].) (3b) Pointing out that the Meads are identified as trustors in the deed of trust appended to the complaint, Sanwa argues that those "specific averments in the Deed of Trust" must control over any "contrary" allegations in the text of the complaint that the Meads are sureties.
It is mistaken. Because sureties include those who hypothecate their property as security for the debt of another (Civ. Code, § 2787), the allegation in the text that they are sureties is not inconsistent with the allegation in the deed of trust that they are trustors.
Even if "trustor" and "surety" were inconsistent, the rule giving precedence to allegations in exhibits could not have had any application in this context. Civil Code section 2832 provides that "[o]ne who appears to be a principal, whether by the terms of a written instrument or otherwise, may show that he is in fact a surety, except as against persons who have acted on the faith of his apparent character of principal." If written instruments attached to a pleading were always given precedence, then a supposed principal would be foreclosed from exercising the statutory right to prove that he or she was actually a surety.

2. The Meads Have Pleaded Sufficient Fact to Support Their Allegation That They Are Sureties Rather Than Principals.

Sanwa relies on Matthews v. Hinton (1965) 234 Cal. App.2d 736 [44 Cal. Rptr. 692] (hereinafter, Matthews) for the proposition that, as a matter of law, the facts alleged establish that the Meads are principal obligors rather than sureties. It reasons that (1) although Sanwa knew that, as between Cooley and the Meads, the Meads were acting as sureties, (2) Matthews holds that that fact is insufficient to establish the Meads' suretyship status vis-a-vis Sanwa.
That analysis fails because Matthews was incorrectly decided.
Like the present case, Matthews arose from an agreement by property owners and their long-term lessees to subordinate the owners' reversionary interest in the fee to a construction loan. The owners did not sign the promissory note made by the lessees, but did execute a deed of trust along with the lessees. (234 Cal. App.2d at pp. 738-739.) The lessees defaulted on the note, and the lender foreclosed upon the property. Contending that they were only sureties, the owners sued the lender for damages for the wrongful sale of the property. (Id., at p. 739.)
*569 The lender in Matthews moved for summary judgment, offering evidence that there was no agreement between itself and the owners except the deed of trust, and arguing that the deed of trust showed that the owners were principal obligors. (234 Cal. App.2d at p. 739.) In their opposition to the motion, the owners neither controverted the lack of a separate agreement nor offered any other evidence except that the lender knew of the lease. (Id., at pp. 739, 742.) Finding no triable issues of fact, the trial court granted the lender's motion for summary judgment. (Id., at p. 739.)
The appellate court affirmed. (Matthews, supra, 234 Cal. App.2d at p. 742.) It noted that every indication from the face of the deed of trust was that the owners had subjected their reversionary interest to primary liability for the lessees' debt. For instance, "[t]here was nothing in the trust deed to tell the lender that its power of sale was limited to the sublessees' estate for years." (Id., at p. 741.) Therefore, the owners appeared to have signed the deed of trust as principal obligors. (Ibid.)
Citing Civil Code section 2832, the court acknowledged that the owners "had a right to show, if they could, that they were actually sureties even though they signed the trust deed as apparent principals." (Matthews, supra, 234 Cal. App.2d at p. 742.) Although they were given the opportunity to make that showing in their opposition to the motion for summary judgment, the court held that they had failed to do so. The evidence offered by the owners  the lender's knowledge of the relationship between the owners and the lessees  was insufficient to show that the owners were sureties (Ibid.) because "[o]ne who signs a security document or other contract as a principal will be held as such even though the creditor knows that as between the signer and his fellow obligor, the former is only a surety" (id., at p. 741). Because the owners presented no other evidence, they failed to support their characterization of their relationship with the lender. Accordingly, they raised no triable issue of fact, and the relationship of the parties could be determined as a matter of law solely from the documents. (Id., at p. 742.)
Thus, Matthews's conclusion that the owners failed to create a triable issue of fact regarding their relationship with the lender is premised upon its assertion that a creditor's knowledge of the existence of a surety relationship between the two obligors does not tend to show the existence of a surety relationship between an obligor and the creditor. However, the California decisional law supporting that premise was statutorily overruled in 1939.
"The rule at common law [is] that a party apparently bound on a written contract as a principal may show by evidence aliunde that he signed the *570 contract as a surety for the principal debtor, and, if such fact is known to the creditor, such party will be bound [to the creditor] as a surety only...." (Granger v. Harper (1932) 217 Cal. 16, 19 [17 P.2d 135].) In 1850, the Legislature adopted the common law as the law of the state when not inconsistent with constitutional or statutory law. (Stats. 1850, ch. 95, p. 219.) Nevertheless, prior to 1872, California did not follow the common law rule on this subject. (Granger, supra, at p. 19.) Instead, the Supreme Court adopted a rule that the maker of an apparently direct and absolute obligation could not vary its terms by parol evidence showing that the maker is merely a surety. (See, e.g., Shriver v. Lovejoy (1867) 32 Cal. 574, 576-577; Aud v. Magruder (1858) 10 Cal. 282, 289.)
In 1872, the Legislature codified the common law rule in the form of Civil Code section 2832, which at the time consisted of a single sentence: "`One who appears to be a principal, whether by the terms of a written instrument or otherwise, may show that he is in fact a surety, except as against persons who have acted on the faith of his apparent character of principal.'" (Granger v. Harper, supra, 217 Cal. at p. 19, quoting the statute.) The effect of that enactment was to statutorily overrule the decisional law announced in cases such as Shriver v. Lovejoy. (Eppinger v. Kendrick (1896) 114 Cal. 620, 626 [46 P. 613].)
Nevertheless, the Supreme Court continued to restrict the ability of an apparent principal to prove that he or she was actually a surety. It did so by first observing that it was possible for a person who has agreed with a creditor that he and a co-obligor will be liable to the creditor as principals to at the same time agree with his co-obligor that, as between the two of them, the co-obligor would be primarily liable for the debt. (Harlan v. Ely (1880) 55 Cal. 340, 342.) Therefore, the court reasoned, evidence of the creditor's knowledge of the surety relationship between the two obligors was not enough, by itself, to bind the creditor to treat the surety as such. (California Nat. Bank v. Ginty (1895) 108 Cal. 148, 150-151 [41 P. 38].) It adopted the rule that alleged sureties must "aver and prove that the payee of the note not only knew of the fact of suretyship between [sic] them and their co-obligor, but consented to deal with them in that capacity...." (Farmers' Nat. Gold Bank v. Stover (1882) 60 Cal. 387, 392; accord, Granger v. Harper, supra, 217 Cal. at pp. 19-20; Casey v. Gibbons (1902) 136 Cal. 368, 371 [68 P. 1032].)
In 1939, the Legislature rejected that interpretation by amending Civil Code section 2832 to add a second sentence: "It is not necessary for him [i.e., the apparent principal who claims to be a surety] to show that the creditor accepted him as surety." (Stats. 1939, ch. 453, § 28, p. 1799.) That *571 amendment therefore statutorily overruled Farmers' Nat. Gold Bank v. Stover and its progeny, which said that the alleged surety must prove that the creditor agreed to treat him as a surety.
It also overruled Harlan v. Ely and its progeny, which held that proof of the creditor's knowledge of the surety arrangement between the obligors was not enough because the creditor might have a contrary agreement. If the alleged surety need no longer affirmatively disprove the existence of a contrary agreement, then there is no reason why proof of the creditor's knowledge is not sufficient to allege a prima facie case. For instance, when a principal sells property securing a debt to a buyer who agrees to assume liability for the debt, the buyer becomes the principal and the seller is relegated to the status of a surety. After receiving notice of the assumption, the creditor must afford the former principal the rights of a surety. (Everts v. Matteson, supra, 21 Cal.2d at pp. 447-448; Westinghouse Credit Corp. v. Wolfer (1970) 10 Cal. App.3d 63, 67-68 [88 Cal. Rptr. 654].)
Despite the 1939 statutory amendment and its rejection of the rules stated in prior decisions such as California Nat. Bank v. Ginty and Casey v. Gibbons, those are exactly the outdated cases upon which Matthews relies for the proposition that an apparent principal must be held to be a principal rather than a surety even though the creditor knew that the obligors intended that person to be merely a surety. (See Matthews, supra, 234 Cal. App.2d at p. 741, citing, inter alia, California Nat. Bank and Casey along with Estate of Chamberlain (1941) 44 Cal. App.2d 193, 200 [112 P.2d 53], which in turn relies entirely upon California Nat. Bank.) Accordingly, Matthews is, in our view, wrongly decided, and we decline to follow it.
(4) As the result of the 1939 amendment to Civil Code section 2832, California has fully adopted the common law rule described in Granger v. Harper: If a creditor knows that its obligors have agreed between themselves that one will be the principal and the other will be the surety, the latter is bound to the creditor as a surety only, even though he or she appears from the written instruments to be a principal. (217 Cal. at p. 19; 72 C.J.S. (1987) Principal & Surety, § 28, p. 188.) Therefore, if an apparent principal alleges both that his or her relationship with a co-obligor is one of surety and principal and that the creditor knows of that agreement between the two obligors, he or she has alleged sufficient facts to support the allegation that he or she is bound to the creditor as a surety only.[2]
(3c) The Meads pleaded that they were sureties of Cooley. Sanwa's knowledge of the fact that the Meads were hypothecating their property to *572 secure Cooley's debt is demonstrated by the loan documents Sanwa prepared: the construction loan agreement and the note are signed by Cooley alone; the deed of trust identifies the secured obligation as being that of Cooley; and the deed of trust expressly provides that the Meads shall have no personal liability for that debt. The complaint also alleges that Sanwa's officer considered the Meads to be third parties rather than principal obligors. These facts are sufficient to support their allegation that they are bound to Sanwa as sureties only.
By itself, however, that allegation does not demonstrate that the trial court erred by sustaining the demurrers. As will be seen, while the Meads have sufficiently pleaded their status as sureties, they have not demonstrated that their complaint pleads sufficient facts to constitute a cause of action against Sanwa.
B.-D.[*]
.... .... .... .... .... .... .... .

DISPOSITION
The judgment of dismissal and the postjudgment order awarding attorney's fees are affirmed. Sanwa shall recover its costs on appeal.
Richli, J., and Ward, J., concurred.
Appellants' petition for review by the Supreme Court was denied May 13, 1998.
NOTES
[*]   Pursuant to California Rules of Court, rules 976(b) and 976.1, this opinion is certified for publication with the exception of parts B, C, and D.
[1]  In their complaint, the Meads refer to themselves, not as sureties, but as guarantors. However, the distinction between guarantors and sureties was abolished in this state by the 1939 amendment to Civil Code section 2787. (Bloom v. Bender (1957) 48 Cal.2d 793, 797 [313 P.2d 568].)
[2]  Even under the common law, the general rules governing suretyship relationships can be varied by private agreements between the parties. (Rest.3d Suretyship and Guaranty, § 6.) In particular, as the Supreme Court noted long ago in Harlan v. Ely, it is possible for a surety to bargain away the rights of suretyship and agree with a creditor to be liable as a principal. (55 Cal. at p. 342.) However, to prove a surety's agreement to be treated as a principal obligor, it would seem that the creditor should not be able to rely solely on an agreement from which it merely appears that the surety is a principal. It would seem that, if the creditor knows of the surety status between its co-obligors, any agreement obligating the surety to be treated as a principal should expressly address that distinction. (See, e.g., Chandler v. Chandler (1945) 326 Ill. App. 670 [63 N.E.2d 272, 274], where the notes recited that "Each maker of this note is a principal.") An agreement that is absolutely silent on the issue of the surety's rights as a surety would not be persuasive evidence that the surety agreed to surrender those rights. However, since the only issue before us is the adequacy of the Meads' complaint, we need not and do not decide those issues.
[*]   See footnote, ante, page 561.
