L.A.
Mine did that BIG TIME around this age but outgrew it and is able to willingly and spontaneously share. She won't be this way forever!
You may want to see if you can get her to understand that the toys come back to her. Or if she is designated to be the toy giver, that may help. Another thing is to have the kids keep a toy for 1 minute (they keep track, and it's way off, but that's okay) and then swap.
She's still young at 2 and even at 3. You may just want to keep the other kid out of her sightline or do things that don't involve toys. Another thing is giving playdates a rest & see if the phase passes as mysteriously as it started.