In our house, the kids don't always have to share. They have their own stuff. They only have to share it with the baby, not yank it form her if she comes and tries to touch it.
BUT. They do have to do what we say, and they're not allowed to be mean or bratty. This includes when we're out with friends or in public, they know they DO have to share if we say so with other kids, and not defy us, and not throw any fits or get angry.
It's not about the sharing, it's ALWAYS about doing what you say, and stopping wrong (aggressive or tantrummy) behavior when you say so. She DOES have control over her behavior at 3 when you tell her to be nice once you have instilled it.
We always gave one calm warning to stop at the beginning of any aggressive, tantrummy, mean brattiness, and told them that they would lose the toy immediately AFTER a consequence if they continued, and then one firm swat if it continued for even a second as well as losing the toy-as we had warned. We never got upset or let it escalate. After only a couple of times for each child, they didn't begin the habit, and have been able to stop an outburst at just a warning since somewhere around 2. But this was easy due to consistency with other things and early training, a 3 year old in the habit of being mean would take more repetition.
If I hear some sort of escalation brewing, I'll ask casually: "Do you guys need my help resolving that?" and they'll go back to playing nicely. This works in public, wherever.
Conversely, they don't always have to behave. I let them fight and go nuts sometimes too if it's just us at home alone and I don't mind. But they know whenever I SAY SO, they have to listen. You don't want to be always bearing down on them about stuff. This way they see there is a time and place for everything, and you're being fair. At first when it clicks she'll superficially choose praise over swats (which still works), but her own conscious will take over quickly once you set the boundaries effectively. Both my kids liked to share by 3 and they're very sweet kids. Same with their cousins raised this way. Even when they're "fighting" they're constantly saying, "sorry" and "are you ok?" and "OK, let's be nice now" and sharing voluntarily.