Teamwork is a popular buzzword in business, but not all teams perform equally well. Teams made up of co-workers who are friends were more successful at completing group tasks than those composed of professional colleagues, acquaintances or strangers, according to a new study.

“Working with friends is not just something that makes us feel good. It can actually produce better results,” Robert Lount, a co-author of the study, said in a statement. However, the study also found that on certain kinds of tasks, teams of friends are less effective than those of strangers or acquaintances.

Larger teams had a greater friendship advantage than smaller teams.

The researchers analyzed data from 26 studies that included over 1,000 teams made up of nearly 3,500 people. Some teams in the studies consisted of workplace friends while other teams were strangers or acquaintances.

Teams of friends performed better than teams of strangers and acquaintances across all age groups. And larger teams had a greater friendship advantage than smaller teams. One reason for this is that friends can coordinate tasks more effectively than non-friends and acquaintances. “They know each other’s strengths and weaknesses, and can figure out how to break up the work in the most efficient way,” said Seunghoo Chung, lead author of the current study.

People working with friends tend to be in a better mood and can work through the stress and difficulties that come from having to produce a lot in a short time. “When the goal is maximizing output, the biggest issue is keeping people motivated, and that is where friends are helpful,” said Chung.

Friendship teams did better than other teams if the task required producing the most output. However, no advantage was seen if the goal was to identify an optimal solution to a problem.

When the goal is to come up with the best solution to a problem, however, a team of strangers may have an advantage over a team of friends. Strangers or merely acquaintances are more likely to disagree in a constructive way, discuss the pros and cons of proposed solutions, and are less likely to go along with the crowd, so to speak, explained Lount, an associate professor of management and human resources at The Ohio State University.

“Managers should look for ways to build teams around groups of friends,” suggests Chung. And Lount adds that long-term productivity may increase if employees are having fun together. So managers may also want to start having non-mandatory social events, such as happy hours, and team-building exercises to encourage friendships.

The study is published in Personality and Social Psychology Bulletin.