The mother of an unmarried minor born out of wedlock is entitled to its custody, services, and earnings subject to the court's right to award custody of the child to either parent, considering the best interests of the child as to its temporal, mental, and moral welfare.
SDCL 25-5-10