In last week's parsha (ויצא) we have the story of the birth of Dina. Rashi there comments (based on the Medrash) that Leah understood that she was pregnant with a boy and if she had another boy then Rachel would only have 1 of the shevatim, therefore she davened and Hashem made a miracle and turned the baby into a girl, Dina.
In Parshas ויגש, the Torah writes when it lists the descendents of Yaakov, ואת דינה בתו. Rashi comments (based on the Gemara in Nidda) that we see that the Torah calls Dina the daughter of Yaakov to show us that the father is responsible for having a daughter. The Maharsha there asks, what is the proof from Dina, after all Dina started off as a boy (per the medrash in ויצא) and therefore how can any proof be brought from Dina? He answers that the תרגום יונתן has a different peshat there. The תרגום יונתן says that both Leah and Rachel were pregnant, Leah was pregnant with Yosef and Rachel with Dina and miraculously the fetuses were switched. Therefore, Dina was always a girl and the proof from the pasuk is fine because Yaakov caused Dina to be a girl.
Rashi comments (based on the medrash) on the pasuk ושאול בן הכנענית, that after what happened with Shechem, Dina made Shimon promise to marry her. The Tur asks how could Shimon marry Dina? Even בני נח are not allowed to marry their sister from their mother. The Tur answers based on the תרגום יונתן that the Yosef and Dina were switched, and therefore על פי הלכה Leah was not Dina's mother, rather Rachel was and a בן נח is allowed to marry his sister from his father.
This Tur however, raises another question, what about Yosef? Who על פי הלכה is considered to be his mother? If it is Leah, then what good was the נס? Rachel still ended up with only 1 of the shevatim. Therefore we need to differentiate and say that both Dina and Yosef were Rachel's children.
When we consider how the halacha determines who the the mother of a baby is there are 3 possible alternatives:
1. Whoever conceives the child
2. Wherever the fetus is 40 days after conception (as until then it is considered מיא בעלמא and for example you are allowed to daven for the sex of the child)
3. Whoever gives birth
We see that the Tur cannot hold from 1 because even though Yosef was conceived by Leah he is considered Rachel's son. The Tur cannot hold from 3 either as the Tur holds that Dina was considered Rachel's daughter even though Leah gave birth to her. It would seem that the Tur holds like option 2.
With this we can say the following about Yosef. Leah was pregnant with Yosef but it was before 40 days while Rachel was pregnant with Dina and it was after 40 days. Therefore when they switched Yosef was less then 40 days so he was considered Rachel's son as on day 40 he was in Rachel's womb, while Dina had already passed day 40 in Rachel's womb so she was considered Rachel's daughter even though Leah gave birth to her.
It turns out according to the Tur that Rachel was the mother of both Dina and Yosef.
This Tur clearly has ramifications l'halacha with regards to surrogate mothers etc.