Upon the affidavit of a defendant, before answer in an action upon contract or for the recovery of personal property, that some third party, without collusion with the defendant, has or makes a claim to the subject of the action, and that the defendant is ready to pay or dispose of the same as the court may direct, the court may make an order for the safekeeping, or for the payment, or deposit in court, or delivery of the subject of the action, to such person as it may direct, and an order requiring such third party to appear in a reasonable time and maintain or relinquish his or her claim against the defendant. If such third party, being served with a copy of the order by the sheriff or such other person as the court may direct, fails to appear, the court may declare such third party barred of all claim in respect to the subject of the action against the defendant therein. If such third party appears, he or she shall be allowed to make himself or herself the defendant in the action in lieu of the original defendant, who shall be discharged from all liability to either of the other parties in respect to the subject of the action, upon compliance by the defendant with the order of the court for the payment, deposit, or delivery thereof.