"Research across several disciplines suggests that such bonds may come from cognitive flexibility and ecological advantage, rather than simple instinct, and evidence from field studies and controlled behavioral experiments shows that cross-species social relationships occur more often than previously observed and may play a meaningful role in survival and cooperation."

https://economictimes.indiatimes.com/news/international/us/some-animals-are-choosing-companions-from-other-species-and-scientists-want-to-know-why/articleshow/129142847.cms

Some Animals Are Choosing Companions From Other Species, and Scientists Want to Know Why

Animals are forming lasting social bonds with different species, engaging in cooperative hunting and peaceful companionship. Research suggests these cross-species relationships stem from cognitive flexibility and ecological advantages, offering mutual benefits and playing a role in survival and cooperation. Evidence from starlings, octopuses, and domesticated animals highlights adaptable social strategies shaped by shared habitats and learning.

Economic Times