If it is in the chain of command, one reporting to the other, it creates what we call an “adverse relationship”. If it is not in the same chain of command, it is not an offence, but we have to make very sure that there is not a perceived conflict of interest.
One thing we need to get much better at understanding, though, in this case of rank differential, is power dynamics.