Tom Hanks bears a shocking resemblance to children's television star Fred Rogers, who he plays in the upcoming film "A Beautiful Day in the Neighborhood." But the similarities are more than just good casting — the performers are actually related, according to a discovery made by Ancestry.com.

Hanks is sixth cousins with Rogers, and they share the same great-great-great-great-great grandfather, Johannes Mefford, a company representative told CBS News. The company utilized its database of over 20 billion online historical records to form Hanks' family tree, the representative said.

The star and his wife, fellow actor Rita Wilson, appeared to learn of the news for the first time while speaking with Access Hollywood at a New York City screening of the upcoming film Monday. "No. Impossible. No, you're pulling our leg," said a shocked Wilson.

Get Breaking News Delivered to Your Inbox

After the outlet revealed the family tree, Hanks and Wilson came around to the news. "It all just comes together, you see," said Hanks.

The family tree shows the two entertainment icons are distantly related. Ancestry

Rogers, who died in 2003, hosted "https://www.misterrogers.org/" from 1968 to 2001 and was known for his positivity and care for children.

The new film tells the story of a reporter whose life changes after he meets Rogers. Matthew Rhys plays Lloyd Vogel, a journalist for Esquire tasked with profiling the icon. The film is based on Rogers' real-life friendship with journalist Tom Junod, which began in 1998 when Junod wrote an article about the TV personality. The movie premieres on November 22.

Watch the trailer for "It's a Beautiful Day in the Neighborhood"

Read more on Tom Hanks: