
42 Cal.2d 752 (1954)
CARSON J. HAUGER et al., Appellants,
v.
CHARLES E. GATES et al., Respondents.
Sac. No. 6326. 
Supreme Court of California. In Bank.  
Apr. 30, 1954.
 Joseph E. Isaacs, Alan H. Critcher, Donald M. Haet and Louis Garcia for Appellants.
 Edward T. Koford and Bryce Swartfager for Respondents.
 SPENCE, J.
 Plaintiffs brought this action to set aside an extrajudicial sale made under a deed of trust. Defendants' demurrers to plaintiffs' second amended complaint were sustained without leave to amend. From the judgment accordingly entered for defendants, plaintiffs appeal. They maintain that the allegations of their second amended complaint were sufficient to state a cause of action for the setting aside of the sale, as such allegations showed that plaintiffs were entitled to a setoff or counterclaim in an amount exceeding the amount due on the note, and that therefore they were not in default on their obligation. (Code Civ. Proc.,  440.) We have concluded that their position is well taken.
 As alleged, plaintiff Carson J. Hauger agreed to purchase from defendants Charles E. Gates and his wife for $16,000 certain real property in the county of Sonoma, together with the improvements thereon and certain specified ranch equipment. Pursuant to the agreement, defendants Gates executed and delivered to plaintiffs a deed to the realty; and plaintiffs executed and delivered a promissory note and second deed of trust as security for the unpaid portion of the purchase price. *754 In the deed of trust plaintiffs were the first parties-trustors, defendant Sonoma County Abstract Bureau was second party-trustee, and defendants Gates were third parties-beneficiaries.
 Plaintiffs failed to make certain payments under the deed of trust and defendants Gates failed to make the agreed delivery of certain personal property. Thereafter and on December 11, 1950, defendants Gates and the Sonoma County Abstract Bureau recorded a notice of breach and election to sell under the deed of trust. Plaintiffs claim that they were not then indebted to defendants Gates because the latter, in breach of their contract, had failed to deliver to plaintiffs the agreed personal property, valued at $987.50, which sum exceeded the amount of the installments then due under the promissory note and deed of trust; that plaintiffs repeatedly told defendants Gates that they would pay the overdue installments if the Gateses would return the personal property but the latter refused. On April 12, 1951, the property was sold by the Sonoma County Abstract Bureau, the trustee under the deed of trust, to defendant Chalmers, who allegedly had full knowledge of the above-recited facts and was "not a purchaser in good faith or for value" but holds the property "in trust" for defendants Gates. The property was sold for $5,025 to defendant Chalmers, and the deed therefor was accordingly made and recorded. The Exchange Bank of Santa Rosa holds a first deed of trust on the property, calling for monthly payments of $65. Defendants have made certain of these payments to the bank and in the event the sale is set aside, plaintiffs are willing to pay to defendants Gates and "all other defendants ... who may be entitled thereto such sums as may in right, justice and equity be owing from ... plaintiffs to defendants."
 Plaintiffs' theory of relief rests upon the proposition that a trustor under a deed of trust is entitled to offset money owing to him by the beneficiary against the amount secured by the deed of trust; and that where there was not in fact any indebtedness due from the trustor to the beneficiary under the note secured by the deed of trust, the sale thereunder may be set aside. Section 440 of the Code of Civil Procedure provides: "When cross-demands have existed between persons under such circumstances that if one had brought an action against the other, a counterclaim could have been set up, the two demands shall be deemed compensated so far as they equal each other, and neither can be deprived of the benefits thereof by the assignment or death of the other." *755
 [1] Under this section plaintiffs had a setoff which they were entitled to assert. The cross-demands between plaintiffs and defendants Gates existed at the time the notice of default was declared and the sale under the deed of trust was held. By reason of their failure to deliver certain personal property to which plaintiffs were entitled under the agreement of sale, defendants Gates were indebted to plaintiffs in a greater sum than the amount of the unpaid installments owing by plaintiffs on their promissory note. [2] These allegations of plaintiffs' complaint must be accepted as true for the purposes of demurrer, and accordingly plaintiffs were not in default at the time of the sale. [3] Section 440 is explicit in stating that the coexisting cross-demands shall be "compensated so far as they equal each other," which necessarily means that each of the claimants is paid to the extent that their claims may be balanced in amount.
 Plaintiffs and defendants Gates were aware of the cross-demands prior to the sale proceedings; plaintiffs had informed defendants Gates that they would pay the installments on their note if the Gateses in turn would deliver the personal property as theretofore agreed; and then, without regard for the consequences of their own breach of contract and the damages thereby caused to plaintiffs, defendants Gates proceeded with the sale. [4] Section 440 makes it clear that plaintiffs' right of setoff was available without the necessity of bringing an independent action setting forth the related dealings between the parties. (See Walters v. Bank of America, 9 Cal.2d 46, 54-55 [69 P.2d 839]; Williams v. Pratt, 10 Cal.App. 625, 632 [103 P. 151].) And the fact that plaintiffs' demand is an unliquidated claim for damages for breach of the contract of sale with the Gateses does not affect their right to the setoff. [5] Section 440 does not require that the cross-demands be liquidated. (Sunrise Produce Co. v. Malovich, 101 Cal.App.2d 520, 525 [225 P.2d 973].)
 [6] It would not be reasonable, as contended by defendants, to interpret section 440 of the Code of Civil Procedure so as to permit the right of setoff in a foreclosure action under a deed of trust and yet to deny such right where the foreclosure was attempted by extrajudicial sale thereunder. On the contrary, it would appear that the provisions of said section are equally applicable in relation to either type of proceeding. Section 438 of the Code of Civil Procedure provides that "the right to maintain a counterclaim shall not be affected by the fact that either plaintiffs or defendant's claim *756 is secured by mortgage or otherwise, nor by the fact that the action is brought, or the counterclaim maintained, for the foreclosure of such security." It therefore appears that the choice of remedy under a deed of trust is an extraneous factor, not going to the merits of the claimed right to a setoff.
 Defendants argue that plaintiffs should be barred by laches from now raising the disputed issue in an effort to set aside the sale. Defendants point out that plaintiffs did not file the present action until 70 days after the sale; that four months prior to the sale plaintiffs, by the recording of the notice of default, were put on notice regarding the forthcoming sale; and that a period of "thirty days is about the utmost length of time which the courts are disposed to allow" for rescission of a sale. (Schneider v. Henley, 61 Cal.App. 758, 763 [215 P. 1036].) However, the cited case has no relevancy to the problem here, for plaintiffs do not seek to rescind their purchase agreement but rather they stand on their contract and their rights thereunder. [7] A court of equity will consider all the surrounding circumstances where the defense of laches is interposed. (10 Cal.Jur.,  62, p. 523.) [8] It may be conceded that plaintiffs' most prompt procedure would have been by way of an action seeking to enjoin the trustee's sale. But the fact that they failed to so proceed does not bar them from resort to the present action for an adjudication of their rights. The delay was not unduly prolonged and does not appear to have caused any detriment to the parties involved as the sale was made to defendant Chalmers, who allegedly "was acting for and on behalf of defendants [Gates] ... and ... was not a purchaser in good faith or for value."
 For the reasons stated, we conclude that plaintiffs' second amended complaint stated a cause of action, and that the trial court erred in sustaining defendants' demurrers without leave to amend.
 The judgment is reversed.
 Shenk, J., Edmonds, J., Carter, J., Traynor, J., and Schauer, J., concurred.
