Hadith: The Child Is For The Owner Of The Bed
There is no explicit ruling in this regard. This is an administrative matter to be decided by the state on case-to-case basis. The verdict of Prophet Muhammad (SWS) was also of the same nature where an administrative decision was made after considering the circumstances of the case where people were transitioning from old customs regarding slaves to new ones, to discourage old customs of adultery with slaves and adultery as a general practice and the fact that actual biological father of the child was not alive anymore etc. In the example asked, if the matter is brought to the court of law, then the court may rule in favor of the biological father, and can also decide certain consequences for the couple as well. The consequences may also vary from case-to-case.