The child grows and develops in society. At the initial stage, his society is limited to the family. Then you start going for walks together, where, in one way or another, you get to know other young parents and their children. The first elements of interactions between young people begin and here it is important not to miss the moment and help your child adapt to society with dignity.
It is useful to teach children about collective types of games. All kinds of round dances and "streams", where children hold hands, allow them to get closer due to tactile sensations. Add to this the general idea and purpose of the game, and you have no-spill friends. Together, practice a few childhood friendship songs that are so fun to sing out loud in chorus! Arrange "little ducklings" dances with common movements.
Observe how your toddler interacts with a peer. Such observations are primarily useful for the parents themselves, because until the moment they met their peers, communication took place within the family and 99% of his behavior among other people came from there. Maybe the toddler is greedy or even aggressively takes away toys. Notice the tense moments in the child's interaction, discuss them with your child at home in a friendly conversation. Ask leading questions to understand the motives behind your child's unfriendly behavior. Offer him some fun points of view on the problem and play them with your toddler like a theater actor.
It is also possible that your child simply demonstrates brilliant upbringing and tact, and the other kid is not so smart. It doesn't matter, because all people are different. Do not protect children from communicating with each other. After all, if there is no mutual understanding, they themselves will not become close friends. But if they still have much more in common, then this will only add to your child's awareness of the diversity of the universe around.
One thing is for sure: by forbidding children to communicate with each other, you can easily become an enemy of your own children. Children are very categorical and are just learning to distinguish shades of halftones. Be their number one friend and always respect their personal opinions. Because if this opinion is not their own, but yours - without you in their future life they will remain in complete confusion. If you strive to educate a self-sufficient person, immediately treat this person as self-sufficient. But, possessing worldly wisdom, just remove obstacles from their path.