If the plaintiff be a trustee to any other, or if the action be in a name of the plaintiff who has no real interest in the contract upon which the action is founded, so much of a demand existing against those whom the plaintiff represents or for whose benefit the action is brought, may be set off as will satisfy the plaintiff's debt, if the same might have been set off in an action brought by those beneficially interested.