27-1-502. Survival of counterclaim -- death or assignment. When cross-demands have existed between persons under such circumstances that if one had brought an action against the other a counterclaim could have been set up, the two demands shall be deemed compensated so far as they equal each other and neither can be deprived of the benefit thereof by the assignment or death of the other.