Answer
Wa `alaykum as-salamu wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
While some jurists based the child’s inheritance on the biological parenthood, others see that it can be based on the civil contract of marriage.
In his response to your question, Dr. Monzer Kahf, a prominent economist and counselor, states,
Dear Br. Anas, you are right, the issue is controversial. There is no explicit text about it. The point is that there is agreement that a baby borne out of adulterous relation inherits from his mother because we are sure he came from inside her womb. As for the relation with the father, it can only be related to the marriage contract.
Now, if there is a civil marriage contract between the mother and the Muslim man who fathered him through this marriage, this is also acceptable.
Recognition by the biological, not marital, father is accepted by some scholars, the Hanafis, instead of marriage contract while it is not by others, especially the Shafi`is.
For more about inheritance, see these fatwa:
Can Men and Women Receive Equal Inheritance Shares?
Difference in Inheritance between Men and Women: Why?
Can We Choose to Split Inheritance Shares Equally?
Denying Females Their Share in Inheritance: Permissible?
Allah Almighty knows best.