At this stage, your child plays alongside their friends, rather than with them. (‘Parallel play’ vs ‘cooperative play’.) Toddlers aren’t very sociable, but that doesn’t mean they don’t like playing with other children – quite the opposite. They just regard their friends a bit like a fun toy. And they see their playmates’ food and toys as public property, theirs for the taking.
We’re not born sociable and generous; we learn these skills by being with others. Children aren't initially that good at making friends, but they get better and better at it with time. It’s just a matter of practice. Ease them into it gradually with one or two friends, just for short plays. That's a good start.