Section 38. If, while an action is pending, the plaintiff is summoned as trustee of the defendant on account of a counterclaim filed therein, such pending action shall be subject to the three preceding sections in the same manner and with the same effect as if it were an action brought upon such counterclaim by the defendant against the plaintiff.