Pope Francis on Friday heard the confession of five participants in this week's World Youth Day event in Brazil and noted the importance that grandparents have in the lives of families and the value of dialogue among generations.

"Children and the elderly are building the future of the world's peoples. Children because they are the next step in history, the elderly because they can hand down the experience and wisdom of their entire lives. This relationship, this dialogue among generations, is a treasure we must preserve and nourish," the pope said at the praying of the Angelus.

Constantly followed by thousands of people who never stopped cheering him and expressing their affection, the former Cardinal Jorge Bergoglio took his place in one of the 50 confessionals installed in Rio de Janeiro's Quinta da Boa Vista park and heard the confessions of three boys and two girls.

After the confessions, Francis moved on in the open-topped popemobile to the palace of Rio's archbishop, where he had a private meeting with five young prison inmates.

After being surrounded by vivas and the applause of tens of thousands of people, the Argentine pontiff appeared on the central balcony of the palace to recite the Angelus.

The first pope from Latin America recalled that this Friday the church celebrates the feast of Saints Anne and Joachim, the parents of the Virgin Mary, and said the two saints belong to "that long chain that has handed down the love of God within the warmth of the family."

"How precious is the value of the family as a privileged place to pass along the faith!" he said.

Francis recalled that many countries of the world celebrate the feast of grandparents, and observed "how important grandparents are in the life of the family for communicating that heritage of humanity and faith that is essential for all society!"

After the Angelus, Francis met with members of the local committee of World Youth Day and had lunch at the archbishop's palace with a representative group of 12 youths. EFE