On demurrer- to a counterclaim defendants challenge the sufficiency of the complaint. People v. Booth, 32 N. Y. 397.
*717Plaintiff sues as assignee of an undertaking on appeal, and the point of objection to his pleading is that it shows in him no title to the undertaking. 'The alleged assignment was in July of a paper not executed till the following September. But, the assignment being also of “ any other undertaking to be given by the plaintiff herein,” took effect on the execution of such subsequent undertaking. Field v. City of New York, 6 N. Y. 179. “The title to the undertaking vested in equity in the plaintiff by virtue of the original agreement.” Perry v. Chester, 53 N. Y. 240, 243.
The defendants insist further, that even though the assignment be effectual, it was, in terms, of an undertaking on attachment; whereas here the action proceeds upon an undertaking on appeal. But the undertaking was on an appeal from the order vacating the attachment, and besides reciting that it is “ in lieu and stead ” of the undertaking' on attachment, it expressly binds the defendants to pay “ all damages which ” the attached defendant “ may sustain by reason of said attachment and by reason of said appeal.” A part of the damages so suffered by that defendant is the indebtedness he incurred to the plaintiff for professional services in vacating the attachment, and it is to obtain compensation for those services that the plaintiff prosecutes the action on defendants’ promise of indemnity.
Defendants object that, at best, plaintiff exhibits only a right to equitable relief, but that is enough against a demurrer. Hale v. Omaha Nat. Bank, 49 N. Y. 626, 632.
The complaint being good, the question recurs as to the validity of the counterclaim.
Plaintiff argues that the undertaking, in action is not a contract; but the contention is repugnant to principle and. against, the weight of authority. Wickham v. Weil, 17 N. Y. Supp. 518; Delaney v. Miller, 78 Hun, 18; Atwater v. Spader, 12 N. Y. St. Repr. 506; Cornell v. Donovan, 14 Daly, 295.
Nevertheless the demurrer must prevail.
The assignment of the undertaking to the plaintiff took effect in equity at the time of the original agreement, July 18, 1895; while the judgment proposed as a counterclaim was acquired by defendants the 30th of the ensuing August. ■ “ If the action is founded upon a contract, which has been assigned by the party thereto — a demand existing against the party thereto — at the time of the assignment thereof, and belonging to the defendant, must be allowed as a counterclaim.” Code Civ. Proc., § 502, *718subd. 1. Since at the time of the assignment to plaintiff the judgment against his assignor was not the property, of the defendants — indeed did not exist — it may not be interposed as a counterclaim against the plaintiff.” “ To compel a set-off of two demands there must be a mutual right of action upon them at the same time.” Taylor v. Mayor, 82 N. Y. 10, 17; Willover v. First Nat. Bank, 40 Hun, 184, Myers v. Davis, 22 N. Y. 489; Martin v. Kunzmuller, 37 id. 396; Fera v. Wickham, 135 id. 223.
Independently, however, of the assignment to plaintiff, he had a lien on the' undertaking in suit for compensation of his services .in avoiding the attachment, in securing the undertaking, and in procuring the adjudications which made the undertaking of value and available to his client, and this lien is not to be defeated by a set-off between the parties to the action. Delaney v. Miller, 84 Hun, 244; Perry v. Chester, 53 N. Y. 240; Dienst v. McCaffrey, 32 N. Y. Supp. 818; Ely v. Cooke, 28 N. Y. 365, 373; Ennis v. Curry, 22 Hun, 584.
■ Defendants urge an equity in their favor from the insolvency of their debtor, but the same insolvency tells for the plaintiff; and his right to be recompensed for his labor out of its fruits, gives him an equity prior in time and superior in merit.
However, be the equity of defendants ever so persuasive, their counterclaim, to b*e valid, must comply with the conditions of the statute. Willover v. First Nat. Bank, 40 Hun, 184, 189.
Demurrer sustained, with leave to defendants to- amend answer within twenty days on payment of costs of the demurrer, and in case the defendants do not elect to amend, the plaintiff to recover such costs in the event of his success in the action.
Ordered accordingly.