I am looking for a similar solution. We have a course with two groups of students and a professor for each group. We've set the permissions on the Non-Editing Teacher role so that each professor can only see the students from their group, but the students can see all students from both groups as well as both professors.
We need the students to only be able to see the other members of their group, non-editing teachers included.