What is the meaning of [A forced kindness deserves no thanks]

No doubt the doer of the kindness is thanked, but he does not deserve to be if
he has done it against his will – or to further his own ends.