So connecting different dots from this thread, let me paint a very plausible scenario, that probably happens more in our society than we like to believe.
Two cousins got married. Had a kid. Found out later that wife was fed milk once by husbands mother, when wife was a baby. That made husband and wife, siblings - which immediately nullified the nikah. Is their kid, an illegitimate child now? I think so. So does that mean that the poor child is not going to get any inheritance? Seems pretty unfair to him, if you think of if.
A child will inherit from the mother always because there is no doubt she’s the mother. If the father accepts the child then the child will also inherit from him.