derenDeren
or dessen
are used to prevent misunderstanding concerning possessions in sentences with more than two persons or two groups of persons.
In your example it actually doesn't matter, but try to figure out who are the parents of the son in this sentence: Sie haben ihre Freunde und ihren Sohn eingeladen
. The son could belong to family 1 or family 2. But using Sie haben ihre Freunde und deren Sohn eingeladen
it's clear, the son belongs to their friends.