This is known as kin selection.
Behaviors which increase the reproductive success of genetic relatives increase the inclusive fitness of the individuals. If you have discussed Hamilton’s rule, recall that an allele will rise in frequency in the population over time if rb > c. Where r is the relatedness coefficient (to the relative benefitting from the behavior), b is the additional offspring that the relative has, and c is the personal offspring that are lost.