
450 P.2d 921 (1969)
Xavier TORRES, Plaintiff-Appellant,
v.
Victoria GONZALES, Defendant-Appellee.
No. 8692.
Supreme Court of New Mexico.
February 24, 1969.
Wright & Kastler, Raton, for plaintiff-appellant.
Duran & Goodman, Albuquerque, for defendant-appellee.

OPINION
COMPTON, Justice.
Xavier Torres, the putative father, brought this action to obtain the custody of the minor child from its mother, Victoria Gonzales. During the course of the trial, and before the plaintiff had rested his case, the court sustained defendant's motion to dismiss with prejudice, and the plaintiff appeals.
The court dismissed the action on the grounds, (a) lack of an indispensable party, Saturnino L. Trujillo, formerly the husband of the defendant, and (b) that plaintiff has no standing in court and has no legal basis upon which he could prevail.
The facts are not controverted. The parties agree, and the court is in accord, that they are the natural parents of the child and that they were never married to each other. The child was born to the defendant May 3, 1962, and at that time the defendant was the wife of Saturnino L. Trujillo. Subsequently, Trujillo sought and obtained a divorce from the defendant, and the decree was filed December 13, 1963. The judgment in the divorce proceeding was made part of the record by stipulation and it specifically states "that during the *922 month of December, 1960 the Plaintiff and Defendant permanently separated and no longer live or co-habit together as husband and wife," and "that no children have been born to the parties as the issue of their said marriage."
It is obvious that the court in determining that the plaintiff had no standing to sue relied on the presumption that a child born in wedlock is legitimate as being exclusive. We think the court fell into error. The defendant by her brief concedes this. The presumption is rebuttable. Salas v. Olmos, 47 N.M. 409, 143 P.2d 871. The presumption may be rebutted where the evidence is clear, cogent and convincing that the husband is not the father of the child. We think the evidence meets this test.
The court also stated that since the husband is presumed to be the father of the minor, he is a necessary and an indispensable party to the action. We disagree. As previously noted, the presumption that the husband is the father of the child is clearly rebutted; the decree in the divorce case is which the husband was a party found that no children were born of the union, thereby determining that the husband was not the father of the child, thus eliminating any possible question of any rights in him to custody under § 32-1-4, N.M.S.A. 1953. The provisions of this statute apply only to "parents." In our view the husband of the natural mother of an illegitimate child of which he is not the natural father is not the "parent" of the child merely because married to the mother. Compare Hill v. Patton, 43 N.M. 21, 85 P.2d 75; In re Clark's Estate, 228 Iowa 75, 290 N.W. 13; Boroughs v. Oliver, 217 Miss. 280, 64 So.2d 338.
Defendant argues that notwithstanding any errors committed by the court, the case should be affirmed because plaintiff was not prejudiced inasmuch as he had failed to prove defendant was unfit to have the custody, or that the best interests of the child dictated that she be deprived of it, both of which she asserts were required before the court could award custody to the father. 10 C.J.S. p. 80 Bastards § 17b. We need not determine if this is the correct rule. Assuming for the sake of argument that it is, as plaintiff appears to do, nevertheless the trial was stopped and the case decided in favor of defendant before plaintiff had completed his case and rested. He here asserts that he intended and was attempting to prove the mother's unfitness, and the best interests of the child, when the court ruled that he had no standing to sue. The trial court ruled prematurely and, accordingly, it cannot be established that any error in its determination that plaintiff lacked standing was harmless. Compare Home Fire and Marine Insurance Co. v. Pan American Petroleum Corp., 72 N.M. 163, 381 P.2d 675.
It thus follows that the natural father has standing to litigate the custody of the child notwithstanding the fact that he was never married to the mother. The cause is reversed and remanded to the trial court with directions to reinstated the case upon its docket and proceed in a manner consistent with this opinion.
It is so ordered.
NOBLE, C.J., and MOISE, J., concur.
