Make the sentence less toxic: if you are a woman, you are not allowed to speak to a man unless you have a male relative with you, and you are not allowed to
If you're a female, if you don't have a boyfriend or relative by your side, they won't let you talk.