When it comes to choosing their friends, fish are most likely to bond over favorite foods. According to a recent study published in the journal Behavioral Ecology and Sociobiology, some types of fish bond when they eat the same thing for dinner, choosing to shoal with other fish who consume the same foods they do—regardless of species.

Scientists at the School of Life Sciences at the University of Lincolnshire studied the shoaling behavior of three-spined sticklebacks and nine-spined sticklebacks. They found that when they fed the fish different types of food, those fish who consumed the same foods tended to associate with each other, whether or not they were the same species. When they fed the sticklebacks the same food, meanwhile, the fish had no particular preference for their own species.

“This behavior is most likely mediated by the general familiarity of diet-derived chemical cues, as the fish were previously housed in different tanks and were unfamiliar to one another,” researcher Tanja Kleinhappel explains. “We don’t believe that the observed shoaling behavior of the fish is controlled by visual or other non-dietary cues that are specific to a particular species, and the results therefore suggest the general familiarity of shared chemical cues could be a way by which to induce shoaling behavior between fish of the same and different species.”

Researchers believe their findings illustrate the importance of chemical cues in animal socialization. Though subsequent studies are needed to determine exactly why fish associate with those who eat the same foods, researchers believe the phenomenon may serve a protective purpose.

“Associating with fish that smell the same might be all about food and protection,” Kleinhappel explains. “By associating with others that share the same preference for particular types of food, a fish ensures that it has enough to eat. Being surrounded by similar-smelling fish also protects an individual against predators that use certain chemical search patterns to detect prey.”