dd2 has recently been very upset because her friend wants to kiss her (peck on cheek stuff).
no big deal.
except dd2 doesn't want her to, leading to her friend chasing her around, with dd2 getting more and more upset - dd2 has been taught to stop if someone says they don;t like it/want to play (she is no paragon of virtue, please belive me! but does follow the rules, especially in school). we have been very hot on this in particular, as she really needs to listen to dd1 if dd1 is saying 'no'
but, froma typical, average, small child's point of view - absolutely fantastic! guaranteed way of getting attention/winding someone up, all in the guise of 'playing' (again, it's not as though all other small children are evil and only want to wind ehr up, but the guaranteed reaction is always a good thing to exploit)
from what you say, it sounds as though your dd is having trouble keeping up with social situations. ie, she can understand rules, but cannot flex them (and they are always flexed, bent and broken - especially at primary school!) to make sense of everyday situations.
is she much better with adults?
we have been working on things like this with dd2 al her life, seemingly - obvously because we have been slowly teaching the same rules ot her older sister, and so dd2 has been soaking it up alongside. and of course, she is more than aware that different people react differently, given her sister's issues.
one way we talk it up is to eg find something she is good at (like following the rules - gold star, although with my dd2 is it embarrassingly 'goody two shoes' at times), and something she is not so good at (but that someone she likes/admires/looks up to - preferably a peer). talk through the differences, and how everyone learns at different rates (we found it helpful to also model for her that mummy/daddy/beloved-oh-so-perfect teacher also make mistakes, and that mistakes don't matter - how you deal with it matters), and everyone finds different things easy/difficult/somewhere int he middle.
so, when dd2 complains that her friend is trying to kiss her, and why doesn't she listen, and just stop like she is supposed to, we talk about how her friend is finding it a bit harder to learn to listen when people say 'stop', but that she is good at other things (some of which dd2 finds hard, some easy) - like swimming, where her friend is top of the class. and that eventually, we all know the same things, but we learn them in different orders, etc.