Hammad bin Abi Sulayman said: In the case of two lineages, the one from which the lineage is valid will inherit, and the one from which the lineage is not valid will not inherit.
Brief Explanation
(Explanation of Hadith 3120)
For example, if someone has married his mother, sister, or daughter, then the relationship of being a mother is valid, but being a wife is not valid. Therefore, she will inherit in the capacity of a mother, not in the capacity of a wife. The same applies to a sister and a daughter.
And Allah knows best.