A sweeping analysis of more than 72 million Facebook users has found a big bonus to having rich friends.

When poor children grow up around wealthier kids and parents, they are much more likely to earn a higher salary later in life, researchers at Harvard, Stanford, and New York Universities have found.

The findings suggest there really is something to the phrase, "it's all about who you know".

On average, researchers found that if a child from a low socioeconomic family lives in an area where 70 percent of their friends are wealthy (which is typical for most wealthy kids), their adult income increases by an average of 20 percent.

That's a very strong correlation. Not even factors like education or occupation give as strong a boost for future income.

But there's bad news, too. Crossing the income divide to make friends appears to be very rare in the United States, a second analysis by the same group shows.

Outside Los Angeles, almost none of the low socioeconomic zip codes in the US that researchers analyzed showed high levels of economic connectedness. In other words, children tend to hang out with others their age that come from similar classes.

"It may be that there is little scope for people with low [socioeconomic status] to connect with individuals with higher [socioeconomic status] if there are few such people in the vicinity," the authors write.

Researchers have long suspected that societal relationships can influence income inequality and economic opportunity in a society. But until recently, large-scale data to support that hypothesis have been hard to come by.

Social media offers an opportunity to study this idea like never before.

Using Facebook data, researchers analyzed 21 billion online friendships, which is about 3,500 times larger than the most widely used dataset for social networks to date (known as Add Health).

The studies considered a variety of factors that could help a kid get ahead in life, including family income, family background, educational attainment, occupation, and neighborhood.

In the end, economic connectedness was the only measure of social capital that strongly correlated with upward income mobility. (Growing up in a single-parent household, however, had a negative impact on whether kids moved upwards in income and economic status.)

There are many explanations as to why that is. Making friends at school with kids from higher-income families, for instance, could help shape a child's aspirations or provide access to information and job opportunities they otherwise wouldn't have had.

"This is consistent with hypotheses that bridging capital is useful specifically for getting ahead (rather than simply getting by)," the authors write.

"However, there are also many alternative explanations for the correlation between [economic connectedness] and mobility that do not rely on a causal effect of connectedness on mobility," they add.

For example, the type of low-income family that chooses to live in an area with high economic connectedness may possess other demographic characteristics that influence their child's rate of upward mobility, or make choices to invest in their children's education.

The current study was only able to demonstrate a correlation between economic connectedness and a child's future economic prospects. But this relationship was so strong it's worth investigating further.

In the second study, researchers found the extent to which friendships develop across class lines depends on both a person's exposure to other classes and their willingness to befriend other classes.

If a person gravitates toward making friends with people from their own socioeconomic group, as tends to happen in schools, colleges, and neighborhoods, then interventions like affordable housing or diverse college acceptance rates might not be enough to improve income inequality.

Initiatives might be better off fostering connections between people from different backgrounds, giving them ample opportunity to form proper friendships.

Interestingly, researchers at Harvard found that communities with other forms of high diversity, like race, do not necessarily have higher levels of upward mobility. What really matters is that they show economic diversity and interconnection.

"People interested in creating economic connectedness should equally focus on getting people with different incomes to interact," study author and NYU economist Johannes Stroebel told The New York Times.

If the authors are right, climbing the income ladder might be a whole lot easier if you have friends in high places giving you a hand.

The study was published in Nature.