Can relationships be used to show Content and linked content in the same view
create a view filtering by classroom node types
add a relationship like "Entity Reference: Referencing entity", it is related to teacher nodes that are referencing the classroom node.
after this, add the classroom node fields and using that relationship, add the teachers fields.
in the format views settings, you can choose a field to grouping this nodes, so, choose the node reference field.


This view configuration, it will works only if the node reference field is in teacher node.