This case may be viewed in two as.pccts—one legal, the other equitable. At law, if A makes promissory notes for the accommodation of B, the payee, and *297they arc subsequently negotiated and dishonored, A has no cause of action against B until lie first pays the notes, and then his action is tor money paid to B’s use {Cow. Tr. § 317, and cases cited). Tested by these common law rules, the outstanding liability pleaded by the defendant constitutes no defense to the demand in suit. But, A (the defendant) pleads, as lie lawfully may, to a common law action, an equitable defense {Code Civ. Pro. § 507), to wit: (1) the insolvency of B. (2) That as the notes given to B were for B’s accommodation, B in point of fact is principal, and A merely surety thereon, and that B agreed to indemnify and save A harmless therefrom. It is true A has no claim till he has paid something on the liability, but in • equity he may, as surety, apply to the court for such relief as will compel B to discharge the liability (8 Wend. 194; 6 Paige, 258; 3 Swanst. 368).
A would be entitled to this relief if he had commenced* a suit in equity for that purpose; and the Code of Civil Procedure (§ 507), in effect provides that he may obtain such relief by means of an equitable defense. The judgment for the plaintiff may provide that the defendant be allowed to pay the amount of any recovery in discharge of his liability (Hannay v. Pell, 3 E. D. Smith, 432). The present action resembles very much the case last cited, and the relief claimed may' be granted (B being insolvent), though the liability of A has not as yet matured (Lindsay v. Jackson, 2 Paige, 581). In the present instance part of the liability has matured and is in judgment, as in Hannay v. Pell (supra). The plaintiff is an assignee of B for the benefit of creditors, and this equitable defense is equally available against him (Smith v. Felton, 45 N. Y. 419; Rothschild v. Mack, 3 N. Y. State Pep. 471).
The Code provision in regard to equitable defenses applies to the city court as fully as to the supreme court of the State {Code Civ. Pro. § 3347, snbd. 4). It follows that the defendant has pleaded a good equitable defense, and that the demurrer thereto must be overruled, with costs.