(a)B is indebted to C, and A is surety for the debt. C demands payment from A, and on his refusal sues him for the amount. A defends the suit, having reasonable grounds for doing so, but he is compelled to pay the amount of debt with costs. He can recover from B the amount paid by him for costs, as well as the principal debt.