A person will give birth to a daughter if she witnesses his wife giving birth to a boy when she is actually pregnant. And she will give birth to a boy if she has a daughter.
And Allah knows best.