In the abstract, there are probably several ways that it could work, or maybe it can't work as a practical matter.
Assuming the court that entered the order was made aware that the two children are school classmates, then the order should have taken that into account.
If you want to provide a bit of background/context, someone may be able to offer additional info.