(CNN) Having children will make you happier than staying childless, according to a new study, but not until later in life, when they have flown the nest.

A team of researchers at Heidelberg University in Germany found that parents tend to be happier than non-parents in old age, but this only holds if their kids have moved out.

Previous research has suggested that parenthood, social networks and marital status affect the well-being and mental health of older people, and this latest study looks at the effects of family status.

Scientists asked 55,000 people age 50 and over from 16 European countries about their mental well-being, and results suggest "the positive aspects of parenthood dominate when getting older."

One of the biggest factors is that children become a form of social support, and the researchers point out that social support networks are associated with greater happiness and less loneliness and can act as a buffer against stressful events.

Read More