thank you for sharing your question with the Wefugees Community!
If a father wants to claim rights such as child custody or for example wants to get a residence permit through his child it is important for him to acknowledge paternity of the child ("Vaterschaftsanerkennung"). In Germany the legal situation is that if a man and a woman are married, the man in the marriage automatically becomes the "legal father" of the newborn child. However, if the mother and the father of the child are not married, the father needs to acknowledge paternity before a notary or the youth welfare office ("Jugendamt"). It´s not a genetic test but more a statement. Therefore the approval of the mother is necessary.
If in your case the mother of the child doesn´t want your friend to acknowledge paternity, he would probably have to take the case before the family court to claim his paternity. Since I am not a specialist on this field I can´t tell you exactly how this works. If your friend and the mother of his child are not able to work their differences out between each other, your friend therefore should probably get himself a lawyer specialised in family law (Familienrecht). If he doesn´t have any money to pay one he can **** for free counselling centers that are specialised in family law.
Also note that for a residence permit through a german child besides the document about the acknowledgment of paternity ("Vaterschaftsanerkennung") its also good to have a statement called "Sorgerechtserklärung" in which the parents of a unmarried child state that they want to raise the child together.
I hope this answer was helpful for you. If you have any more questions please don´t hesitate getting back to the Wefugee Community!
All the best
Note: Please keep in mind that we can´t provide qualified legal advice via the internet and that any information given can´t replace such legal advice.