How do you handle other kids being mean to your child?

M

I brought my daughter to a toddler play time at a local library the other day and a little girl there kept trying to take what my daughter was playing with and would cry when she couldn’t have it. At times I had to pull my daughter away because I thought this other girl was going to hit her with a block. Her mom was right there and would occasionally tell her to share or not to take my daughters toys but I realized I’m not good at talking to my daughter in those situations. I don’t always want to tell my daughter to share and give up what she’s playing with just because another kid is acting like a brat 😏 but I’m not sure what to say and do? My instinct is to correct the other child but I know that’s not my place to do. Any advice on this?

I’d like to add that my daughter is very sweet natured and did eventually share her toys with multiple kids in the room with out being asked. Shes very nurturing and kind and I don’t want her to be mistreated or taken advantage of because of that. At least not when I’m with her