My children have been subject-accelerated, socially they had good experiences (as in nothing negative), but their friends were friends in their regular grade-level class. From my perspective friendships had little to do with age or subject acceleration, but proximity - they were closest with the kids they spent most of the day with.
One of my children is a competitive athlete and works out with a multi-age team for a significant portion (days and hours) of the week. She's in a multi-mix age of kids every day of the week, has been for several years, and has friends who are both older and younger (although mostly older, as she's on the younger end of the age range for her competitive level). The kids do have one big thing in common (the love of their sport) but they also have a lot of other things in common - music they like, eating pizza, watching videos, playing other sports, crafting, slumber parties, driving their parents nuts etc. Finding common ground wasn't difficult, but it happened among themselves, spending time together. I think it would be tough to try to push or create a friendship scenario (which I realize isn't what you're thinking of doing)... I'd just let whatever happens happens. If your dd and a friend from her SA class wanted to hang out together, yes, 5th graders "hang out" (that's what my kids start calling playdates once they'd reached the age they primarily chose their friends vs parents arranging playdates based on what was easy for parents). The two reasons I think it's not something that will work well for a parent to encourage with a 5th grader and on up is that by 5th grade, most kids typically choose their friends, and the kids in that one class probably have a set of friends and possibly busy after-school schedules. They're in the class for math, not hanging out in the one class all day naturally forming friendships. It doesn't mean they aren't great kids and that your dd won't find a friend there or that a friendship won't work, it's just highly unlikely that it's worth the effort to try to create a way to facilitate a friendship - if it happens, that's great, but if not, I wouldn't worry about it.
Re preparing for middle school, that's still two years off and the kids who aren't subject accelerated are going to be hitting puberty around that time. That was a time of huge social stuff in my kids lives... lots of friendships changed up, social groups moved around etc... so if a friendship did form this year, I wouldn't count on it to be stable through the start of middle school.
Hope that didn't sound negative - it wasn't meant to be.
Best wishes,
polarbear