
175 Conn. 527 (1978)
JOHN PI
v.
JANE DELTA[*]
Supreme Court of Connecticut.
Argued May 2, 1978.
Decision released August 1, 1978.
COTTER, C. J., LOISELLE, BOGDANSKI, LONGO and RUBINOW, JS.
*528 Mark Shapera, for the appellant (plaintiff).
Philip M. Finkelstein, for the appellee (defendant).
COTTER, C. J.
The plaintiff seeks a writ of habeas corpus to determine the custody of four minor children. The defendant's motion to quash the petition was granted by the court, and from the judgment granting the motion the plaintiff has appealed to this court.
The function of a motion to quash, which is equivalent to a demurrer, is to test the legal sufficiency of the allegations of the petition. Adamsen v. Adamsen, 151 Conn. 172, 175, 195 A.2d 418. On such a motion, the allegations of the petition are deemed to be admitted. Practice Book, 1963, § 453; Doe v. Doe, 163 Conn. 340, 341, 307 A.2d 166.
The petition alleged, inter alia, that the plaintiff is the father of four minor children who are presently in the custody and control of the defendant; *529 that the defendant is an unfit person to have custody and control of the children; that the plaintiff is a fit person to have custody and control of the children; and that the welfare of the children will best be served by placing them in his custody.
In their briefs and arguments before this court, both parties admit that the children in question are illegitimate, and that the defendant is their mother. While these undisputed facts were not alleged in the plaintiff's petition, it would serve no useful purpose for this court to ignore them since it is clear that the theory upon which this matter was presented to the trial court was dependent upon an acknowledgment of these facts.
We consult the memorandum of decision in the absence of a finding to ascertain the grounds on which the court acted. Colli v. Real Estate Commission, 169 Conn. 445, 448, 364 A.2d 167. Although the judgment granting the defendant's motion to quash simply indicates that it was predicated upon a finding that the plaintiff lacked standing, the court's memorandum of decision states that its judgment was based upon the conclusion that in order to have standing in a habeas corpus proceeding involving questions of custody, "the petitioner must have a special interest, and that the essential elements of such interest are parenthood, cohabitation and support." Further, the trial court observed that in view of § 45-43 of the General Statutes, providing that the mother is the sole guardian of an illegitimate child, "the natural father may not, under ordinary circumstances, interfere with her custodial privilege."
The plaintiff in his appeal raises two issues, viz, the necessity of alleging a period of support and *530 cohabitation in a habeas corpus action by the father of illegitimate children in order to possess standing to litigate the question of custody, and the constitutionality of § 45-43.
"The use of habeas corpus to obtain custody was established at an early date in this state. When so used, the issue is not the illegality of confinement, as is normally the case, but rather what is best for the child." 2 Stephenson, Conn. Civ. Proc. § 259 (a) p. 1063; Kearney v. State, 174 Conn. 244, 249, 386 A.2d 223. A minor child is in the position of a ward of the state; Howarth v. Northcott, 152 Conn. 460, 464, 208 A.2d 540; and "[t]he jurisdiction exercised by the court rests on its inherent equitable powers and exerts the force of the state, as parens patria[e], for the protection of its infant ward. LaBella v. LaBella, 134 Conn. 312, 316, 57 A.2d 627." Howarth v. Northcott, supra, 464-65; Doe v. Doe, supra, 342-43.
In the present case, both the trial court and the defendant mother of the illegitimate children relied upon § 45-43 of the General Statutes and the United States Supreme Court case of Stanley v. Illinois, 405 U.S. 645, 92 S. Ct. 1208, 31 L. Ed. 2d 551, in support of the claim that an allegation of fatherhood alone is insufficient to confer standing upon a plaintiff seeking custody of his illegitimate children through a writ of habeas corpus. Although § 45-43 provides that the mother is the sole guardian of an illegitimate child, this court has consistently held that, in a habeas corpus action concerning a minor child's custody, the court's primary concern must be the best interests of the child, and the legal rights of no one, including a parent, are allowed to militate against this. Sullivan v. Bonafonte, 172 Conn. 612, 614, 376 A.2d 69; Doe v. Doe, 163 Conn. 340, 343, 307 *531 A.2d 166; Howarth v. Northcott, supra; Kelsey v. Green, 69 Conn. 291, 298, 37 A. 679. The right to sole guardianship conferred upon the defendant by § 45-43 does not absolutely preclude the natural father of an illegitimate child from seeking a judicial determination of custody or visitation in view of what is best for the child. See Doe v. Doe, supra; Sullivan v. Bonafonte, supra.
Moreover, recent decisions of the United States Supreme Court regarding the rights of unwed fathers do not compel us to affirm the action of the trial court in the present case by concluding that standing is acquired only when a period of cohabitation and support is alleged in conjunction with the allegation of fatherhood. In Stanley v. Illinois, supra, it was held (p. 652) that both the due process clause and the equal protection clause of the fourteenth amendment entitle the father of an illegitimate child to the same hearing as a legal father to determine his fitness before being deprived of custody of his child, since his interest in retaining custody is "cognizable and substantial." Although the facts of Stanley involved a father who had "sired and raised" his illegitimate children; id., 651; it is not clear from a reading of Stanley that the facts therein are prerequisites to all the constitutional protections afforded unwed fathers under the holding of that case.[1] For example, in the recent case of Quilloin v. Walcott, 434 U.S. 246, 98 S. Ct. 549, 54 L. Ed. 2d 511, in which the court (p. 256) sustained *532 the constitutionality of a Georgia statute which denied the father of an illegitimate child the absolute veto power over adoption of his child which was provided to a married father, the court found it appropriate to observe that, although the natural father had not taken steps to support or legitimate the child over a period of more than 11 years, he was provided with a right to a hearing on "his individualized interests in his child" and was "given the opportunity to offer evidence on any matter he thought relevant, including his fitness as a parent."
Notwithstanding the constitutional considerations expressed in the foregoing authorities concerning the rights of an unwed father, in this state the natural father of an illegitimate child is recognized as one possessing a cognizable interest in the custody of his illegitimate child in spite of his failure to establish a subsisting relationship with the child. Pursuant to § 45-61d (2) (A) of the General Statutes, for example, prior to a hearing on a petition for the termination of parental rights, notice is required to be sent to the father of an illegitimate child who has acknowledged his paternity in writing. By virtue of the plaintiff's petition and attached affidavit acknowledging paternity in the present case, therefore, he would be entitled to notice and the right to be heard at any future termination hearing. General Statutes § 45-61f; see State v. Wolfe, 156 Conn. 199, 239 A.2d 509. A natural father's failure to raise, support or be formally adjudicated the father of his illegitimate child does not, therefore, relegate him to the status of a stranger as to his child.
In recognition of the well-established principle that a determination of custody should be premised *533 upon the paramount consideration of what would be in the best interests of the children, a number of jurisdictions have recently taken the view that the natural father of illegitimate children has custodial rights similar to those of a father of legitimate children upon a dissolution of a marriage. See, e.g., Orezza v. Ramirez, 19 Ariz. App. 405, 507 P.2d 1017; Brown v. Bray, 300 So. 2d 668 (Fla.); People ex rel. Irby v. Dubois, 41 Ill. App. 3d 609, 354 N.E.2d 562; Marshall v. Stefanides, 17 Md. App. 364, 302 A.2d 682; Boatwright v. Otero, 91 Misc. 2d 653, 398 N.Y.S.2d 391; Sparks v. Phelps, 22 Ore. App. 570, 540 P.2d 397; Slawek v. Stroh, 62 Wis. 2d 295, 215 N.W.2d 9. Similarly, in accordance with this court's constant emphasis upon consideration for the welfare of minor children, legitimate or not, we perceive no valid reason for denying the admitted natural father of an illegitimate child at the least the opportunity to obtain a judicial determination of custody where, as here, there is an allegation that the present custodian is unfit and that the interests of the children will best be served by a change in custody.[2] See In re J. Children, 50 App. Div. 2d 890, 377 N.Y.S.2d 530; Boatwright v. Otero, supra.
Although we hold that the plaintiff in the present case has standing to maintain a petition for habeas *534 corpus to determine the custody of his minor children, we do not express any opinion as to the desirability of granting the relief requested. The trial court's ultimate decision whether to grant the relief sought by the plaintiff must be made only after a careful evaluation of all the relevant evidence presented and with primary concern for the welfare of the children involved.[3]Sullivan v. Bonafonte, 172 Conn. 612, 613, 376 A.2d 69.
In view of our disposition of this appeal on the question of standing, we need not consider the constitutional question raised by the plaintiff. See Ashwander v. Tennessee Valley Authority, 297 U.S. 288, 347, 56 S. Ct. 466, 80 L. Ed. 688 (concurring opinion of Brandeis, J.); Pepin v. Danbury, 171 Conn. 74, 88, 368 A.2d 88.
There is error, the judgment is set aside and the case is remanded with direction to deny the motion to quash.
In this opinion the other judges concurred.
NOTES
[*]  Upon the suggestion of the parties and in accordance with the spirit and intent of the order of the Superior Court granting the plaintiff's motion to substitute fictitious names, it is ordered that the names of the parties involved in this appeal shall not be disclosed and that the records and briefs shall not be distributed to the various libraries of the state by the Reporter of Judicial Decisions. The records and papers of this case shall be open for inspection only to persons having a proper interest therein and upon order of this court.
[1]  Some legal commentators have expressed the position that the requirement of notice to unwed fathers enunciated in Stanley is not, and should not be, limited to situations where the natural father has raised and supported his illegitimate child, citing difficult problems of proof, subsequent decisions apparently disregarding the absence of such a relationship, and a father's interest in the future companionship and enjoyment of his children. Recent Developments, 49 Wash. L. Rev. 647, 662, 663; 7 Family L.Q. 75, 104-105.
[2]  Any potential for harassment by the father of an illegitimate child through the initiation of a habeas proceeding would appear to be minimal in view of the fact that his written acknowledgment of paternity would subject him to liability for support through proceedings initiated pursuant to § 17-320 of the General Statutes. See State v. Wolfe, 156 Conn. 199, 239 A.2d 509.

Effective July 1, 1978, General Statutes § 17-320, entitled "Relatives obliged to furnish support," provides, in pertinent part, as follows: "The superior court shall have authority to make and enforce orders for payment of support against any person who neglects or refuses to furnish necessary support to his or her spouse, a child under the age of eighteen or a parent under the age of sixty-five, according to his or her ability to furnish such support, notwithstanding the provisions of section 46-10.... Proceedings to obtain such orders of support shall be instituted by a verified petition with summons and order, in a form approved by the judges of the superior court, of the husband or wife, child or any relative or the conservator, guardian or any family relations officer, town or state, or any selectmen or the public official charged with the administration of public assistance of the town, filed in the geographical area in which the petitioner or respondent resides or does business. For purposes of this section, the term `child' shall include one born out of wedlock whose father has acknowledged in writing his paternity of such child or has been adjudged the father by a court of competent jurisdiction, or a child who was born before marriage whose parents afterwards intermarry...." (Emphasis added.)
[3]  It is at that time that the plaintiff's failure to develop a meaningful relationship with his children or to play a meaningful role in raising and supporting them may be assessed by the court as factors relevant to its ultimate decision on the merits of the petition. See Schwartz, "Rights of a Father with Regard to His Illegitimate Child," 36 Ohio St. L.J. 1, 9-10.
