
163 Conn. 340 (1972)
JOHN DOE
v.
JANE DOE
Supreme Court of Connecticut.
Argued May 3, 1972.
Decided July 5, 1972.
HOUSE, C. J., RYAN, SHAPIRO, LOISELLE and MACDONALD, JS.
Sigmund L. Miller, for the appellant (plaintiff).
Richard Greenwald, with whom was James P. Driscoll, for the appellee (defendant).
*341 RYAN, J.
The plaintiff in this case sought a writ of habeas corpus to determine the custody of two minor children. He later amended his petition to add a claim for visitation rights. The defendant moved to quash the petition, and the court granted the motion. From the judgment sustaining the motion to quash the plaintiff has appealed to this court.
The motion to quash is equivalent to a demurrer. Adamsen v. Adamsen, 151 Conn. 172, 175, 195 A.2d 418; State ex rel. Foote v. Bartholomew, 103 Conn. 607, 611, 132 A. 30. Its function is to test the legal sufficiency of the allegations of the petition. On such a motion, the allegations of the petition are deemed to be admitted. Practice Book § 453.
The petition alleged that the plaintiff and the defendant are the parents of a son, Craig, ten years of age; that the defendant is the natural mother of a daughter, Beverly, fourteen years of age; that the plaintiff and the defendant lived together continuously for more than ten years, from 1960 to August, 1970, and that during that period of time the defendant held out the plaintiff to the community and to the children as her husband and the father of both children; that the plaintiff at all times has had great love and affection for the defendant and for the children, has always treated Beverly as his own, and has shown no favoritism to his son Craig; that on or about August 24, 1970, the defendant, without any advance notification to the plaintiff, left the domicil of the parties, taking her daughter Beverly and leaving the son Craig behind; that subsequently the plaintiff, believing that Craig's welfare dictated that he live with his sister and his mother, brought Craig to live with the defendant; that until May 1, 1971, the plaintiff had enjoyed visitation with both children; that Beverly and Craig are now in the custody *342 and control of the defendant and, since May 1, 1971, the defendant has refused to permit the plaintiff to visit the children. The plaintiff further alleged that he is a fit person to have the custody of the children and that their welfare will be best served by placing them in his custody. In the amended petition, the plaintiff alleged that at all times he has supported the children and that he continues to do so, that the defendant has always accepted this support and that the best interests of the children will be served by affording him reasonable visitation privileges.
The defendant's motion to quash is predicated on the failure of the plaintiff to allege guardianship of either child by reason of marriage or judicial proceedings and, as to the child Beverly, the failure to allege that the plaintiff is a parent of the child. By reason of these deficiencies the defendant claimed that the plaintiff is without standing to bring the action.
The plaintiff's appeal challenges only that part of the judgment which relates to his claim for visitation rights. The issue for our determination is whether the plaintiff has standing to bring habeas corpus.
The primary purpose of habeas corpus in matters relating to the custody of children is to furnish a means by which the Superior Court may determine what is best for the welfare of the child. Howarth v. Northcott, 152 Conn. 460, 464, 208 A.2d 540; Baram v. Schwartz, 151 Conn. 315, 318, 197 A.2d 334; Adamsen v. Adamsen, supra, 178. The child is in the position of a ward of the state. Howarth v. Northcott, supra; Dunham v. Dunham, 97 Conn. 440, 443, 117 A. 504. The jurisdiction exercised by the court rests in its inherent equitable powers and exerts the force of the state, as parens patriae, for the protection of its *343 infant ward. General Statutes § 52-466; Howarth v. Northcott, supra; LaBella v. LaBella, 134 Conn. 312, 316, 57 A.2d 627.
The boy involved in this litigation is the illegitimate child of the parties. The defendant relies on § 45-43 of the General Statutes[1] which makes her the sole guardian of the illegitimate child, and she claims that as guardian of the person of the child she alone is entitled to his custody, and that the plaintiff, since he has no right to custody as the father of an illegitimate child, has no right to visit the child. In a habeas corpus action concerning custody of a minor child the court determines what is in the best interest of the child. The legal rights of no one, including a parent, are allowed to militate against this. Howarth v. Northcott, supra; Mullins v. Becker, 113 Conn. 526, 529, 115 A. 705; Pfeiffer v. Pfeiffer, 99 Conn. 154, 157, 121 A. 174; Dunham v. Dunham, supra; Kelsey v. Green, 69 Conn. 291, 298, 37 A. 679. "Neither parent has a right of property in their children of which they cannot be deprived without their consent." Antedomenico v. Antedomenico, 142 Conn. 558, 562, 115 A.2d 659; Goshkarian's Appeal, 110 Conn. 463, 468, 148 A. 379.
In addition to the problem of paternal support for the illegitimate child, the law, from early times, has been concerned with his status. By the common law of England the child was nullius filius. 1 Blackstone, *344 Commentaries, p. 458; Heath v. White, 5 Conn. 228, 232. Connecticut, however, did not accept the common-law rule, but, on the contrary, recognized an illegitimate child as the child of his mother, with all the rights and duties of a child including the rights of support and maintenance from her. State v. Wolfe, 156 Conn. 199, 204, 239 A.2d 509; Pelak v. Karpa, 146 Conn. 370, 372, 151 A.2d 333.
In the case before us, in view of § 45-43, the trial court held that the mother of an illegitimate child is the sole guardian of the child, and that such child is the child of the mother. It also held that as to both children, the petition failed to set forth any basis for a finding that the plaintiff had the right of custody or visitation. By sustaining the motion to quash, the court determined that the plaintiff had no standing to seek the writ.
At the time of its decision the trial court did not have the benefit of the decision of the United States Supreme Court in the case of Stanley v. Illinois, 405 U.S. 645, 92 S. Ct. 1208, 31 L. Ed. 2d 551, decided April 3, 1972. In that case the plaintiff was the father of two illegitimate children and had lived with them all their lives and had provided them with support. The court held that both the due process clause and the equal protection clause of the fourteenth amendment required that an unwed father, like other parents, be entitled to a hearing on his fitness before his children were taken from him. "The private interest here, that of a man in the children he has sired and raised, undeniably warrants deference and, absent a powerful countervailing interest, protection." (Emphasis added.) Stanley v. Illinois, supra, 651. Chief Justice Burger dissented (p. 659) on the ground that the equal protection clause was the only issue properly before *345 the court and that the equal protection clause was not violated by the state's giving full recognition only to those father-child relationships that arose in the context of family units bound together by legal obligations arising either from marriage or from adoption proceedings.
We recognize the fact that the constitutional issues raised in the Stanley case were not presented to the trial court in the present case. We regard this decision of the United States Supreme Court, however, as controlling on the appeal before us.
We must conclude, therefore, that as to the child Craig the plaintiff has alleged sufficient facts to establish his standing to have the issues determined. What is best for the welfare of the child is still the ultimate question to be decided by the trial court.
Because there was no allegation that the plaintiff was the parent or guardian of Beverly, there is no error in the judgment of the trial court in granting the motion to quash the petition insofar as it related to her. There is error in granting the motion to quash the petition in its application to Craig, the judgment is set aside and the case is remanded with direction to deny the motion to quash the petition as to Craig.
In this opinion the other judges concurred.
NOTES
[1]  "[General Statutes] Sec. 45-43. FATHER AND MOTHER JOINT GUARDIANS; REMOVAL. The father and mother of every legitimate child under twenty-one years of age are constituted joint guardians of the person of such minor, and the powers, rights and duties of the father and the mother in regard to such minor shall be equal. Upon the death of either father or mother, the surviving parent of such child shall become the sole guardian of the person of such child. The mother of each illegitimate child under twenty-one years of age shall be the sole guardian of the person of such child."
