The opinion of the court was delivered by
Johnson, J.:Kelly Goudschaal and Marci Frazier were committed to a long-time, same-sex relationship, during which they jointly decided to have two children via artificial insemination. In conjunction with the birth of each child, the couple executed a coparenting agreement that, among other provisions, addressed the contingency of a separation. A few months after the couple separated, Goudschaal notified Frazier that she was taking the children to Texas, prompting Frazier to file this action, seeking inter alia to enforce the coparenting agreement. The district court’s final order divided all of the women’s property, awarded the couple joint legal custody of the two childi'en, designated Goudschaal as the residential custodian, established unsupervised parenting time for Frazier, and ordered Frazier to pay child support. Goudschaal appeals, questioning the district court’s division of her individually owned property and challenging the district court’s jurisdiction and authority to award joint custody and parenting time to an unrelated *733third person. We find that the district court had the legal authority to enter its orders, but we remand for further factual findings.
Factual and Procedural History
The Parties’ Relationship
The relationship of Frazier and Goudschaal began in 1995. At some point, the couple decided to start a family, utilizing assisted reproductive technologies (ART) in the form of artificial insemination. Originally, tire plan was for both women to become pregnant, so that they could share a child from each partner. But when Frazier was unable to conceive, they mutually agreed that Goud-schaal would bear both children. In 2002, Goudschaal gave birth to their first daughter; their second daughter was born in 2004.
Before the birth of their first daughter, Frazier and Goudschaal signed a coparenting agreement. In 2004, the couple executed another coparenting agreement that made provisions for the second child. That agreement identified Frazier as a de facto parent and specified that her “relationship with the children should be protected and promoted”; that the parties intended “to jointly and equally share parental responsibility”; that each of the parties “shall pay the same percent of [child] support as her net income compares to [their] combined net incomes”; “that all major decisions affecting [the] children . . . shall be made jointly by both parties”; and that in the event of a separation “the person who has actual physical custody w[ould] take all steps necessary to maximize the other’s visitation” with the children. In addition, both a consent for medical authorization and a durable power of attorney for health care decisions were executed. Further, each woman executed a last will and testament that named the other as the children’s guardian.
Goudschaal, Frazier, and the two children lived together as a family unit. The adults jointly purchased a home, jointly owned personal property, and shared bank accounts. Although Frazier was primarily responsible for handling the couple’s financial transactions, both parties contributed to the payment of bills and to the educational accounts for the children. For their part, the children used their legal surname of “Goudschaal-Frazier,” and, notwithstanding the absence of a biological connection, both children *734called Frazier “Mother” or “Mom.” The teachers and daycare providers with whom the family interacted treated both Frazier and Goudschaal as the girls’ coequal parents.
At some point, the adults’ relationship began to unravel, and by September 2007, Frazier and Goodschaal were staying in separate bedrooms. In January 2008, Goudschaal moved out of their home. For nearly half a year thereafter, the women continued to share parenting responsibilities and maintained equal parenting time with the girls. In July, however, Goudschaal began to decrease Frazier’s contact with the girls, allowing her visitation only 1 day each week and every other weekend. Finally, in October 2008, Goudschaal informed Frazier that she had accepted a new job in Texas and intended to move there with both girls within a week. Frazier responded by seeking relief in the Johnson County District Court.
Proceedings in the Distnct Court
Frazier first filed a petition to enforce the 2004 coparenting agreement. She also filed a separate petition for equitable partition of the couple’s real and personal property. The first petition was later dismissed, and the petition for partition was amended to include the request to enforce the coparenting agreement. Goud-schaal responded with a motion to dismiss, claiming that the district court lacked subject matter jurisdiction to address Frazier’s requests for child custody or parenting time and arguing that the court could not properly divide certain portions of the parties’ individually titled property.
The district court denied Goudschaal’s motion to dismiss, opining that the district court had “two separate and independent bases for jurisdiction.” First, the court held that the petitioner had invoked the court’s equitable jurisdiction to determine whether “highly unusual or extraordinaiy circumstances” existed which would permit the court to apply the best interests of the child test to grant Frazier reasonable parenting time, notwithstanding the parental preference doctrine.
Secondly, the district court found jurisdiction under the Kansas Parentage Act (KPA), K.S.A. 38-1110 et seq., to consider Frazier’s *735claim that she is a nonbiological parent. Specifically, tire district court pointed out that K.S.A. 38-1126 provides that “[a]ny interested party may bring an action to determine the existence or nonexistence of a mother and child relationship.” (Emphasis added.) The court considered Frazier as having interested party status by virtue of her claim that she has notoriously and in writing acknowledged the mother and child relationship with these children. See K.S.A. 38-1113(a) (motherhood can be established “under this act”); K.S.A. 38-1114(a)(4) (paternity can be established by notoriously or in writing recognizing that status); and K.S.A. 38-1126 (insofar as practicable, the provisions of tire KPA applicable to the father and child relationship also apply to the mother and child relationship).
At the hearing on the petition, in addition to presenting the coparenting agreement, the parties stipulated to the value of the house and proffered evidence regarding all their assets and liabilities, such as retirement accounts, tax returns, mortgages, and income. The district court concluded that the parties lived and operated as a couple who had comingled their assets and thus each had an equitable interest in the other’s financial accounts. The court noted that “[e]ach party received tire benefit of sharing bills and responsibilities in a family setting.” As a result, the court concluded it would result in unjust enrichment if the assets and liabilities were not equitably divided. Accordingly, the court ordered an equalization payment of $36,500 to Frazier and assigned $60,000 of the second mortgage debt on the house to Goudschaal. The debt assignment was required because, as the court acknowledged, Goudschaal’s retirement account could not be divided with a nonspouse.
Regarding the children, the district court determined that an award of joint custody was in the best interests of the children. Goudschaal was awarded residential custody. Frazier was ordered to pay monthly child support and was granted reasonable parenting time. After Frazier resumed visitation with the girls, they began to experience behavioral problems that prompted their being placed in therapy. However, the record does not contain any reports from drat therapist.
*736Goudschaal appealed the district court’s decision. The appeal was transferred to this court on its own motion. K.S.A. 20-3018(c).
Arguments on Appeal
Given the manner in which the arguments have been presented to us and to assure tire parties that we have considered all of their respective arguments, we take the liberty of beginning by summarizing the parties’ arguments on appeal.
Appellant
Goudschaal’s brief to this court asserts two issues, albeit the first issue is divided into subparts. The overarching complaint on the first issue is that the district court violated Goudschaal’s constitutionally protected parental rights when it awarded joint custody and parenting time to a nonparent, i.e., Frazier. Goudschaal summarily dismisses the coparenting agreement by declaring that “an action to enforce a co-parenting agreement ... is not a cause of action recognized by Kansas courts.”
Citing to Santosky v. Kramer, 455 U.S. 745, 753, 102 S. Ct. 1388, 71 L. Ed. 2d 599 (1982), Goudschaal starts with tire premise that child custody is a parent’s fundamental right, protected by the Due Process Clause of the Fourteenth Amendment to tire United States Constitution, and that such protection includes the right to make decisions concerning one’s children’s care, custody, and control. See Troxel v. Granville, 530 U.S. 57, 65-66, 120 S. Ct. 2054, 147 L. Ed. 2d 49 (2000). Relying on state law applying a parental preference doctrine and the notion that parents are presumed to do what is best for their children, Goudschaal then contends that the State cannot interfere with a biological parent’s fundamental right to the care, custody, and control of his or her children unless there has been a judicial finding that tire natural parent is unfit, which did not occur in this case.
Goudschaal asserts that she is the only person with the constitutionally protected status of parent of her children and that Frazier is simply an unrelated third party. Goudschaal refuses to accept that the KPA would permit a person who is not the biological mother of a child or who has not legally adopted the child to be*737come a “mother” within the meaning of the KPA. Specifically, she contends that any presumption arising from a notorious or written acknowledgment of maternity is always rebutted if there is another female who is the known and undisputed birth mother. In other words, Goudschaal argues that known biological lineage always and definitively trumps any statutory presumption of parenthood. She suggests that nothing in the KPA provides for- there to be two mothers, as the district court suggested. Finally, and perhaps more fundamentally, Goudschaal suggests that the question of whether Frazier could be a parent under the KPA is academic because the district court never made that explicit finding in this case.
Goudschaal then argues that, by not qualifying as a legal parent, Frazier has no standing to petition for custody of a child who is not a child in need of care and who has a natural parent who is not alleged to be unfit. Goudschaal points out that this court has said that “ '[i]n the absence of an adjudication that a natural parent is unfit to have custody of a child, tike parent has the paramount right to custody as opposed to third parties In re Guardianship of Williams, 254 Kan. 814, 826, 869 P.2d 661 (1994) (quoting Herbst v. Herbst, 211 Kan. 163, 163, 505 P.2d 294 [1973]). Likewise, Goudschaal recites that
“ ‘[t]here is no mechanism for a third party to intervene in the relationships of an intact family that has not subjected itself to judicial intervention or failed society’s minimal requirements for adequate parenting.’ Morris, Grandparents, Uncles, Aunts, Cousins, Friends: How is the court to decide which relationships toill continue?, 12 Family Advocate 11 (Fall 1989).” In re Hood, 252 Kan. 689, 691, 847 P.2d 1300 (1993).
Continuing in the same vein, Goudschaal avers that the district court erred in finding that it had equitable jurisdiction to award visitation to a third party such as Frazier. Pointing to Hood, Goudschaal contends that there is no common-law right of third-party visitation, but rather those rights have to originate with the legislature. See 252 Kan. at 693-94. Additionally, she quotes from our Court of Appeals, in State ex rel. Secretary of Dept. of S.R.S. v. Davison, 31 Kan. App. 2d 192, Syl. ¶ 3, 64 P.3d 434 (2002): “Third-party visitation is a creature of statute and in derogation of a parent’s constitutional right to direct the upbringing of his or her chil*738dren. Third-party visitation statutes must, therefore, be strictly construed.” Moreover, Goudschaal warns that if courts entertain visitation requests based on what is in the best interests of the children, that will “open[] a floodgate without establishing any boundaries,” and the result will be an increase in the intrusion by the courts into a family’s private life caused by “ex-boyfriends, ex-girlfriends, aunts, uncles, guardians, teachers, daycare providers, nannies, or any other individuals who have formed a relationship with the child.”
The remedy Goudschaal seeks is for this court to vacate the district court’s order granting Frazier joint custody and parenting time. She does not mention vacating the portion of the order that requires Frazier to pay her child support.
For her second issue, Goudschaal complains that the district court treated the division of the parties’ assets as if it were a marital dissolution by adding up all of the assets, subtracting all of the debts, and dividing the remainder in half. She contends that our caselaw has invested district courts with authority to divide the property of cohabitants only to the extent that such property was “jointly accumulated by the parties or acquired by either with the intent that each should have an interest therein.” Eaton v. Johnston, 235 Kan. 323, Syl. ¶ 2, 681 P.2d 606 (1984). Although Goudschaal concedes that the largest asset, the residential real estate, was a jointly acquired, divisible asset, she complains that the parties’ retirement accounts and insurance policies were separate, individual accounts. She asks for the case to be remanded for a reconsideration of the division of assets, applying the appropriate standard.
As an aside, the parties appear to overlook the irony of Goud-schaal’s concession that Kansas courts have jurisdiction over the jointly acquired property of cohabiting adults, while arguing that those same courts cannot acquire jurisdiction over the children brought into existence by the same cohabiting adults. Nevertheless, that is Goudschaal’s position on appeal.
*739 Appellee
Frazier sets up her brief with seven issues, six of which address various aspects of the overarching question of whether the district court had die jurisdiction and authority to award her joint custody and parenting time. The final issue discusses the division of property.
In her first issue, Frazier asserts that the KPA provided a basis for the district court’s exercise of jurisdiction in this case. She acknowledges the absence of an explicit statement from the district court declaring Frazier to be a parent within the meaning of the KPA. Nevertheless, she argues that such a finding can reasonably be inferred from the court’s orders and the record as a whole.
Pointing to this court’s decision in In re Marriage of Ross, 245 Kan. 591, 783 P.2d 331 (1989), Frazier disputes Goudschaal’s contention that biology is the paramount question in this state. Ross held that a district court cannot order genetic testing to determine whether a man is the biological father of a child for whom the man had previously acknowledged paternity, unless the court first determines that such testing will be in the best interests of the child. 245 Kan. at 597. Ross found that the Uniform Parentage Act, upon which the KPA was based, is designed to provide for the equal and beneficial treatment of all children, regardless of their parents’ marital status. 245 Kan. at 597. Consequently, Frazier characterizes the holding in Ross to be that in any action under the KPA, the court must always act in the best interests of the child “when imposing legal obligations or conferring legal rights on the mother/ child relationship and the father/child relationship.” 245 Kan. at 597.
Frazier also' argues in favor of the district court’s interpretation of the KPA provisions to permit the establishment of maternity through the presumption in K.S.A. 38-1114(a)(4), i.e., where parenthood has been recognized “notoriously or in writing.” She points out that Goudschaal voluntarily created and fostered Frazier’s public persona as a mother of the two children. Accordingly, Frazier labels Goudschaal’s “open the floodgates” argument as “simply a time worn red herring.”
*740Finally in her first issue, Frazier contends that the district court was correct in observing that there is nothing in the KPA to prevent a finding that these children had two mothers. Frazier then points out that, if the court cannot utilize the statutory presumptions, the children will be precluded from ever having two parents because of K.S.A. 38-1114(f), which does not recognize a sperm donor as the child’s father without a written agreement between mother and donor. See In re K.M.H., 285 Kan. 53, 72-73, 169 P.3d 1025 (2007) (upholding constitutionality of K.S.A. 38-1114[f]), cert. denied 555 U.S. 937 (2008).
In her next issue, Frazier addresses Goudschaal’s major premise that the court’s exercise of jurisdiction over child custody and parenting time violated Goudschaal’s constitutional due process rights. Frazier contends that Goudschaal knowingly and voluntarily waived those rights when she entered into the coparenting agreement and continued to abide by the agreement even after the couple separated. Frazier points to In re Marriage of Nelson, 34 Kan. App. 2d 879, 125 P.3d 1081, rev. denied 281 Kan. 1378 (2006), where the Court of Appeals upheld a waiver of the constitutionally based parental preference rights in this state.
Alternatively, in the next issue, Frazier contends that cases from the United States Supreme Court dealing with a parent’s liberty interest have not focused on the biological connection, but rather they turn upon tire relationship between parent and child. See Lehr v. Robertson, 463 U.S. 248, 266-67, 103 S. Ct. 2985, 77 L. Ed. 2d 614 (1983) (mere existence of biological link does not merit due process protection; father who fails to develop relationship with child not automatically entitled to direct-where child’s best interests lie). Frazier then creatively argues that if a natural parent is not entitled to due process protection in the absence of a parent and child relationship, tire corollary must also be true, i.e., a meaningful and well-established relationship with a nonbiological parent should be afforded constitutional protection. She points out that the presumption that a parent will always act in the best interests of his or her child only malees sense where tire natural bonds of affection between parent and child have developed over time, rather than merely through genetics. Finally, she argues that Troxel *741cannot be read as making unfitness of the biological parent a mandatory condition precedent to State intervention in custody and visitation disputes with a nonbiological parent, but rather a court must always balance the competing interests.
In her fourth issue, Frazier separately addresses the parental preference doctrine and contends that it does not bar her requést to enforce the coparenting agreement. She devotes considerable space in her brief arguing why this court was wrong in Sheppard v. Sheppard, 230 Kan. 146, 149-54, 630 P.2d 1121 (1981), cert. denied 455 U.S. 919 (1982), when it declared unconstitutional a 1980 amendment to K.S.A. 60-1610(b), which modified the parental preference doctrine. Elsewhere, Frazier argues that if the parental preference doctrine really creates inviolable rights in biological parents, then a court could not refuse to do DNA testing based on the best interests of the child, as the Ross court held.
For her fifth issue, Frazier presents reasons she believes the district court had equitable jurisdiction to consider this case. She contends that her pleadings can be construed as an action seeking specific performance of the coparenting agreement. She counters tire argument that the agreement is unenforceable as an unlawful assignment of parental duties by pointing out that Goudschaal did not abdicate any of her responsibilities but rather simply agreed to share die children’s parenting. Moreover, Frazier argues simply drat there are times when the best interests of the child outweigh the need to stricdy adhere to the biological connection.
For her last issue on child custody and parenting disputes, Frazier attempts to find jurisdiction in this state’s version of the Uniform Child Custody Jurisdiction and Enforcement Act (UCCJEA), K.S.A. 38-1336 et seq. Specifically, Frazier asserts that she fits within the definition of “ ‘[pjerson acting as a parent’ ” under K.S.A. 38-1337(14). But she acknowledges that tire district court did not base its jurisdiction on that statute and did not malee any factual findings in that regard.
With respect to the division of property, Frazier conceded in her brief that the district court did not make any findings as to which items of the couples’ property were jointly acquired or acquired with the intent that they both would share it, as required by Eaton, *742235 Kan. 323. Accordingly, Frazier also asks that the case be remanded to permit the district court to malee the requisite findings.
Amici Curiae
Three amicus curiae briefs were filed in this case. One on behalf of the American Civil Liberties Union, American Civil Liberties Union of Kansas and Western Missouri, and the National Center for Lesbian Rights (collectively ACLU); one by Linda Henry Elrod, Director of the Washburn University School of Law Children and Family Law Center; and one by the National Association of Social Workers (NASW). All three briefs were proffered in support of Frazier s claims.
The ACLU brief suggests factors to consider in determining whether a person has become a de facto or functional parent. The ACLU argues that Frazier should be deemed such a parent either because of extraordinary circumstances or because Goudschaal waived her superior rights as a biological mother and the waiver must be acknowledged to prevent harm to the children. The brief points out that there is a fundamental difference between the circumstance where a third-party is seeking to supplant or supercede the biological mother s rights and the current circumstance where a nonbiological caretaker seeks to share parental duties and responsibilities with the biological mother.
The Elrod brief points us to In re Guardianship of Williams, 254 Kan. at 820-21, which held that courts may intervene to prevent harm to a child in extraordinaiy or unusual circumstances. Elrod contends that the use of ART necessarily creates extraordinary circumstances in parent and child relationships. Moreover, Elrod argues that enforcing ART agreements, such as the copar-enting agreement in connection with the artificial insemination in this case, protects children by providing clarity and predictability. The brief also shares three theories which have been used by other states to grant nonbiological caretakers custody and parenting rights: (1) estoppel; (2) recognition of a parent-like status, whether labeled functional parent, psychological parent, or de facto parent; and (3) a finding that the person is a presumed parent under the applicable state parentage acts. The brief also points us to our de*743cision in In re K.M.H., 285 Kan. at 72-73, where we found that, without a written agreement, a sperm donor has no standing to assert parental rights to the child bom via artificial insemination.
The NASW brief provides us with a number of reasons why the law should be what that amicus would like it to be, i.e., investing a person in Frazier s circumstances with rights akin to a natural parent. NASW informs us that the formation of attachment bonds is critical to a child’s healthy development; that attachment relationships develop despite the absence of a biological' or legal connection between parent and child; that sexual orientation is irrelevant to the development of strong parent and child attachments; and that children experience severe emotional and psychological harm when their attachment relationships are severed.
Jurisdiction and Standing
Goudschaal contends that the most fundamental flaw in tírese proceedings is that Frazier lacked standing to request the relief she sought, which is a jurisdictional question, and that the district court generally lacked subject matter jurisdiction to entertain Frazier’s amended petition. At times, Goudschaal appears to equate jurisdiction with die efficacy of Frazier’s claims for relief. Which party should win a lawsuit is an altogether different question from that of whether the court has the power to say who wins. Moreover, a person’s claim to be protected by rights under the federal Constitution does not deprive the district court of subject matter jurisdiction to determine the applicability of those rights. As we said recently in Miller v. Glacier Development Co., 293 Kan. 665, 669, 270 P.3d 1065 (2011):
“Subject matter jurisdiction refers to the power of a court to hear and decide a particular type of action. Wichita Eagle & Beacon Publishing Co. v. Simmons, 274 Kan. 194, 205, 50 P.3d 66 (2002). Jurisdiction over subject matter is the power to decide the general question involved, and not the exercise of that power. Babcock v. City of Kansas City, 197 Kan. 610, 618, 419 P.2d 882 (1966).”
Standard of Review
“The existence of jurisdiction and standing are both questions of law over which this court’s scope of review is unlimited. Schmidtlien Electric, Inc. v. Greathouse, 278 Kan. 810, 830, 104 P.3d 378 *744(2005) (jurisdiction); 312 Education Ass'n v. U.S.D. No. 312, 273 Kan. 875, 882, 47 P.3d 383 (2002) (standing).” Mid-Continent Specialists, Inc. v. Capital Homes, 279 Kan. 178, 185, 106 P.3d 483 (2005).
Analysis
Goudschaal does not question the district court’s jurisdiction to hear and decide Frazier’s request for a property division. In this state, a district court has the authority to make an equitable division of property that nonmarried cohabitants accumulated while living together. See, e.g., Eaton, 235 Kan. at 328. Consequently, Frazier’s petition stated a claim upon which relief could be granted by the district court, and dismissal of the entire case would have been improper. Cf. Nungesser v. Bryant, 283 Kan. 550, 559, 153 P.3d 1277 (2007) (appellate court must reverse dismissal for failure to state a claim if alleged facts and inferences support a claim on any possible theory).
Instead, Goudschaal contends that our courts only have the authority to address Frazier’s issues on child custody, parenting time, and support when such issues are presented in a divorce action involving two married persons, who would necessarily have to be a man and a woman in this state, or when considering a visitation request by a grandparent or stepparent. See K.S.A. 60-1610; K.S.A. 60-1616; K.S.A. 38-129. She argues that the district court read too much into K.S.A. 60-201(b) when it found therein a grant of equitable jurisdiction over these issues.
The parties’ arguments over whether the district court had “equitable jurisdiction” may be misdirected. Equitable jurisdiction refers to the authority of tire court to impose a remedy that is not available at law. See Stauth v. Brown, 241 Kan. 1, 11, 734 P.2d 1063 (1987) (quoting 27 Am. Jur. 2d, Equity § 70, p. 593) (where “ ‘there is no adequate remedy by an action at law . . . , a court of equity, in the furtherance of justice, may [impose a remedy]’ ”). In Place v. Place, 207 Kan. 734, Syl. ¶ 3, 486 P.2d 1354 (1971), this court suggested that even a court of equity must first have “acquired jurisdiction of a subject matter,” intimating that something more than a need to do justice is required. But once that subject *745matter jurisdiction is established, the court “will reach out and draw into its consideration and determination the entire subject matter and bring before it the parties interested therein, so that a full, complete, effectual and final decree adjusting the rights and equities of all the parties in interest may be entered and enforced.” 207 Kan. 734, Syl. ¶ 3.
An aspect of the equitable relief sought by Frazier was to have Goudschaal specifically perform under the coparenting agreement. “ ‘The jurisdiction of equity to grant specific performance of contracts, or to reform or cancel them in a proper case, is well settled.’ ” Stauth, 241 Kan. at 11 (quoting 27 Am. Jur. 2d, Equity § 70, p. 593). Goudschaal summarily dismisses that jurisdictional basis on the ground that the coparenting agreement was an unenforceable contract. But a court may exercise its jurisdiction over a contractual dispute in order to evaluate the contract’s legality. See National Bank of Andover v. Kansas Bankers Surety Co., 290 Kan. 247, 257, 225 P.3d 707 (2010) (quoting Kansas Gas & Electric Co. v. Will Investments, Inc., 261 Kan. 125, 129, 928 P.2d 73 [1996]) (“ ‘[cjontracts are presumed legal and the burden rests on the party challenging the contract to prove it is illegal’ ”). Accordingly, the district court clearly had jurisdiction to address the consequences of the termination of the parties’ cohabitation arrangement and to determine whether the coparenting agreement in this circumstance unlawfully violated public policy.
Frazier also contended that she had a mother and child relationship with both children, in all respects other than biology. Accordingly, the trial court looked to the KPA provision that permits any interested party to bring an action to determine the existence or nonexistence of a mother and child relationship. K.S.A. 38-1126. Goudschaal challenges that holding by pointing to die definition of parent and child relationship.in K.S.A. 38-1111, which speaks to the legal relationship between the. child and the child’s biological or adoptive parents-. In essence, Goudschaal argues that one must claim to be a biological or -an adoptive parent in order to invoke the jurisdiction of the court pursuant to K.S.A. 38-1126. '
But the only constraint to bringing an action to determine the existence of a mother and child relationship set forth in K.S.A. 38-*7461126 is that the petitioner be an “interested party.” Goudschaal’s suggestion that only a biological or an adoptive parent can be an “interested party” under 38-1126 fails to consider the other provisions of the KPA. Specifically, K.S.A: 38-1114(a) provides for the presumptive establishment of a father and child relationship in certain circumstances, to-wit:
“(a) A man is presumed to be the father of a child if:
“(1) The man and tire child’s mother are, or have been, married to each other and tlie child is born during the marriage or within 300 days after the marriage is terminated by death or by the filing of a journal entiy of a decree of annulment or divorce.
“(2) Before the child’s birth, die man and the child’s modier have attempted to many each otiier by a marriage solemnized in apparent compliance witii law, although the attempted marriage is void or voidable and:
(A) If the attempted marriage is voidable, the child is born during the attempted marriage or within 300 days after its termination by deadi or by the filing of a journal entry of a decree of annulment or divorce; or
(B) if the attempted marriage is void, the child is born witiiin 300 days after the termination of cohabitation.
“(3) After die child’s birth, die man and die child’s modier have married, or attempted to many, each other by a marriage solemnized in apparent compliance with law, although the attempted marriage is void or voidable and:
(A) The man has acknowledged paternity of die child in wilting;
(B) with the man’s consent, tile man is named as the child’s father on the child’s birth certificate; or
(C) the man is obligated to support die child under a written voluntary promise or by a court order.
“(4) The man notoriously or in writing recognizes paternity of die child, including but not limited to a voluntary acknowledgment made in accordance with K.S.A. 38-1130 or 65-2409a, and amendments tiiereto.
“(5) Genetic test results indicate a probability of 97% or greater diat the man is die father of die child.
“(6) The man has a duty to support die child under an order of support regardless of whether die man has ever been married to the child’s mother.”
Obviously, except for subsection (5), the parental relationship for a father can be legally established under the KPA without the father actually being a biological or adoptive parent. That is important because K.S.A. 38-1113 states that a mother “may be established . . . under this act [KPA] ” and K.S.A. 38-1126, dealing with the determination of the mother and child relationship, spe*747cifically incorporates tire provisions of the KPA applicable to the father and child relationship, insofar as practicable. A harmonious reading of all of the KPA provisions indicates that a female can make a colorable claim to being a presumptive mother of a child without claiming to be the biological or adoptive mother, and, therefore, can be an “interested party” who is authorized to bring an action to establish the existence of a mother and child relationship.
Moreover, what is conspicuously absent from Goudschaal’s jurisdictional arguments is any consideration of the power of Kansas courts to protect the interests of our children. We have declared that the public policy in Kansas requires our courts to act in the best interests of the children when determining the legal obligations to be imposed and the rights to be conferred in the mother and child relationship. See In the Marriage of Ross, 245 Kan. 591, Syl. ¶ 2, 783 P.2d 331 (1989). Further, after the family unit fails to function, “the child’s interests become a matter for the State’s intrusion,” in order to avoid jeopardizing the child if “a parent’s claim for the child is based solely or predominantly on [selfish] motives.” 245 Kan. at 602. In order to accomplish this parens patriae function of protecting our children, the district court must necessarily be invested with subject matter jurisdiction.
In short, we find that tire district court had the authority to divide the parties’ property; to determine the existence or nonexistence of a mother and child relationship between Frazier and the two children; to determine the validity and effect of the coparenting agreement; and to enter such orders with respect to child custody, parenting time, and child support that are in the best interests of the children.
Validity of Coparenting Agreement
Key to our decision is a consideration of the efficacy of the parties’ coparenting agreement. As noted, Goudschaal summarily dismisses the agreement as unenforceable, apparently believing that such an agreement is always contrary to public policy and, thus, invalid as a matter of law. We disagree with that blanket condemnation.
*748 Standard of Review
“ ‘[T]he interpretation and legal effect of written instruments are matters of law, Dutta v. St. Francis Regional Med. Center, Inc., 254 Kan. 690, 693, 867 P.2d 1057 (1994), and our standard of review is unlimited on a question of law. Gillespie v. Seymour, 250 Kan. 123, Syl. ¶ 2[, 823 P.2d 782 (1991)].’ Kansas Gas & Electric Co. v. Will Investments, Inc., 261 Kan. 125, 128, 928 P.2d 73 (1996). ‘Regardless of the construction given a written contract by the trial court, an appellate court may construe a written contract and determine its legal effect.’ Federal Land Bank of Wichita v. Krug, 253 Kan. 307, Syl. ¶ 2, 856 P.2d 111 (1993).” Sunflower Park Apts. v. Johnson, 23 Kan. App. 2d 862, 863-64, 937 P.2d 21 (1997).
Analysis
More than a half century ago, in In re Estate of Shirk, 186 Kan. 311, Syl. ¶ 7, 350 P.2d 1 (1960), this court found that not all contracts in which a parent shares or transfers child custody to a non-parent are unenforceable on public policy grounds. There, a mother of a small child orally agreed with her mother—the child’s grandmother—to consent to the grandmother’s adoption of the child, in return for the grandmother’s promise that the mother and child would inherit the grandmother’s estate in equal shares with the grandmother’s son, i.e., one-third each. In addition, grandmother agreed that, if mother married a suitable person who wished to adopt tire child, grandmother would consent to mother’s readoption. Later, grandmother added the additional requirement that mother leave the city in which grandmother was raising the child. Mother fully performed her part of the bargain, including relocating to another city. Grandmother partially performed, including giving her consent to mother’s readoption of the child after mother remarried, but she failed to provide for die inheritance to the mother and child. Mother sought to enforce the contract against the grandmother’s estate, but die district court granted a demurrer, finding die contract unenforceable as violating the statute of frauds and contravening public policy.
On appeal, after finding that the oral contract was supported by adequate consideration and was otherwise enforceable by the mother, the Shirk court ultimately opined that “[the] controversy resolves itself down to the question whether the contract with respect to the mother’s rights violated public policy.” 186 Kan. at *749323. In that regard, Shirk noted that it was so “fundamental that parents may not barter or sell their children nor may they demand pecuniary gain as the price of consent to adoptions .. . that citation of authority is unnecessary.” 186 Kan. at 323. But the court then quoted from 39 Am. Jur., Parent and Child § 30, pp. 621-22, emphasizing that in some jurisdictions an adoption contract or an agreement for the transfer of child custody is not contrary to public policy
“ ‘merely because it provides for the surrender by a parent of his [or her] child to another in consideration of the latter’s promise to give or leave money or property to tire parent or to the child, where it appears that the contract is in fact one which is promótive of the welfare and best interests of the child ....’” 186 Kan. at 323.
Enroute to finding “nothing in the contract as alleged which renders it illegal or void or as against public policy,” 186 Kan. at 326, Shirk related the following principles:
“Public policy forbids enforcement of an illegal or immoral contract, but it equally insists that those contracts which are lawful and which contravene none of its rules shall be enforced, and that they shall not be set aside or held to be invalid on a suspicion of illegality. A contract is not void as against public policy unless injurious to the interests of the public or contravenes some established interest of society (17 C.J.S., Contracts, § 211d, p. 570). Illegality from the standpoint of public policy depends upon the facts and circumstances of a particular case (Stewart v. Fourth Nat’l Bank, 141 Kan. 175, 39 P.2d 918 [1935]), and it is the duty of courts to sustain the legality of contracts where possible (Foltz v. Struxness, 168 Kan. 714, 215 P.2d 133 [1950]). There is no presumption that a contract is illegal, and the burden of showing tire wrong is upon him who seeks to deny his obligation thereunder. The presumption is in favor of innocence and the taint of wrong is a matter of defense (Mosher v. Kansas Coop Wheat Mkt. Ass'n, 136 Kan. 269, 15 P.2d 421 [1932]; Okerberg v. Crable, 185 Kan. 211, 341 P.2d 966 [1959]).” 186 Kan. at 326.
A review of the facts and circumstances of the agreement convinced the Shirk court that “[w]hat was done for [the child] was highly commendable and [the child’s] interests were best served by the family agreement.” 186 Kan. at 325. The court opined that to find grandmother’s promise of an inheritance to be “contrary to public policy, we must ascribe the basest of motives and the most evil of intentions to the mother.” 186 Kan. at 326. Shirk declined *750to do so and refused to declare the contract unenforceable as a matter of law. Accordingly, tire matter was remanded to the lower court to proceed to trial.
Much more recently, our Court of Appeals upheld a child custody agreement that placed the custody of children with a nonparent. In re Marriage of Nelson, 34 Kan. App. 2d 879, 125 P.3d 1081, rev. denied 283 Kan. 1378 (2006). In Nelson, a divorcing mother and father agreed to place custody of their children with the father s sister—the children’s aunt—and memorialized the parenting agreement in the final divorce decree. Placement was not made with the mother because of her continuing relationship with a boyfriend who was on diversion for engaging in sexually inappropriate contact with a 4-year-old child. After the divorce, mother married the boyfriend and sought to modify tire parenting plan, claiming a material change in circumstances. The district court dismissed the modification motion for failure to show a material change in circumstances. Mother appealed, asserting that the parental preference doctrine entitled her, rather than tire aunt, to have custody of her biological children, notwithstanding tire circumstances. In essence, mother was asserting that her parental preference trumped any risk of harm to the children.
On appeal, the Court of Appeals embraced the district court’s reasoning that a parent can waive his or her rights under the parental preference doctrine. The panel noted that the mother’s express waiver of her rights under the parental preference doctrine was accompanied with an acknowledgement that she had been advised by counsel “ ‘of the Kansas Constitutional provisions concerning parental preference,’ ” and “ ‘that the facts and circumstances warrant the third party placement and that the third party placement is in the best interest of the minor children.’ ” 34 Kan. App. 2d at 884. The panel upheld the district court’s enforcement of the parenting agreement. 34 Kan. App. 2d at 888.
Obviously, Shirk and Nelson are not perfect analogs with the instant case. For instance, both of those cases involved a transfer of child custody to a family member, i.e., a grandmother and an aunt, respectively. On the other hand, both Shirk and Nelson involved the outright transfer of custody by the biological parent, *751whereas, here, the biological mother created a coparenting arrangement that simply shared her parenting duties with another without relinquishing her responsibilities as a parent. Moreover, as a matter of law, Goudschaal would be deemed to have retained certain parental duties because her parental rights had not been terminated. Cf. State ex rel. Secretary of SRS v. Bohrer, 286 Kan. 898, 908-09, 189 P.3d 1157 (2008) (natural parent has certain common-law duties which cannot be relieved by consenting to the appointment of a permanent guardian).
Despite factual distinctions, we discern that Shirk instructs us that the coparenting agreement before us is not rendered unenforceable as violating public policy merely because the biological mother agreed to share the custody of her children with another, so long as the intent, and effect, of the arrangement was to promote the welfare and best interests of the children. Likewise, Nelson counsels that where two fit parents knowingly, intelligently, and voluntarily waive their parental preference by entering into a custody agreement with a third party that is in the best interests of the child, the court will enforce the agreement rather than second guess the parents’ decision. See 34 Kan. App. 2d at 884-88.
Goudschaal nevertheless suggests that this court’s holding in In re Hood, 252 Kan. 689, 847 P.2d 1300 (1993), precludes a district court from granting a nonparent any parental rights except for those specifically set forth by statute. Hood interpreted the grandparent visitation statute, K.S.A. 38-129, and determined that someone who was merely “grandparent like” did not have standing to seek grandparental visitation. In so holding, the Hood court wielded a broad brush, declaring:
“We will not create a new common-law right of third-party visitation. The legislature is the forum to entertain sociological and policy considerations bearing on the well-being of children in our state. Any expansion of visitation rights to unrelated third parties ought to originate with tire legislature.” 252 Kan. at 693-94.
It is difficult to square Hood’s abdication to the legislature of the court’s responsibility for the well-being of this state’s children with Ross’ declaration that “[p]ublic policy requires courts to act in the best interests of the child when determining the legal obligations *752to be imposed and the rights to be conferred in tire mother/child relationship and the father/child relationship.” 245 Kan. 591, Syl. ¶ 2. Nevertheless, Hood is factually distinguishable. We are not presented with a circumstance where an unrelated third party wants to become involved with a child who commenced life with two biological parents. The situation presented here is an agreement between two adults to utilize artificial insemination to bring children into the world to be raised and nurtured by the both of them. The biological mother is not abdicating her duties and responsibilities as a parent; she is sharing them. There is not a biological father to displace. See K.S.A. 38-1114(f) (semen donor to inseminate nonwife “is treated in law as if he were not the birth father of a child thereby conceived”); see also In re K.M.H., 285 Kan. 53, 73, 169 P.3d 1025 (2007) (sperm donor must have written agreement with mother to have standing to assert parental rights), cert. denied 555 U.S. 937 (2008).
Further, the court in Hood was presented with tire question of whether it should create the designation of “psychological parent” based on the facts and circumstances of the case. 252 Kan. at 693-94. But here we need not decide on a label to be applied to Frazier because the parties have done that for us. The coparenting agreement designates Frazier as a “de facto parent.” As indicated above, reading K.S.A. 38-1114(a)(4) in conjunction with K.S.A. 38-1113 and K.S.A. 38-1126, the KPA permits the creation of presumptive motherhood through written acknowledgement.
Goudschaal would have us ignore the coparenting agreement and the parental designation therein because of both the Due Process Clause of the Fourteenth Amendment to the United States Constitution and the Kansas parental preference doctrine. But we disagree with GoudschaaTs application of those concepts to this factual scenario.
Granted, in Troxel v. Granville, 530 U.S. 57, 120 S. Ct. 2054, 147 L. Ed. 2d 49 (2000), the United States Supreme Court struck down a Washington state statute that gave anyone the right to petition the court for child visitation. In doing so, the Supreme Court reiterated that parents have a fundamental right to make decisions regarding the care, custody, and control of their children. 530 U.S. *753at 65-66. Likewise, the well-established parental preference doctrine in this state recognizes that
“ ‘a parent who is able to care for his children and desires to do so, and who has not been found to be an unfit person to have their custody in an action or proceeding where that question is in issue, is entitled to the custody of his children as against others who have no permanent or legal right to their custody.’
[[Image here]]
“The best interests of the child test. . . has long been the preferred standard to apply when the custody of minor children is at issue between the natural parents of the child or children. However, absent highly unusual or extraordinary circumstances it has no application in determining whether a parent, not found to be unfit, is entitled to custody as against a third-party nonparent.” In re Guardianship of Williams, 254 Kan. 814, 818, 826, 869 P.2d 661 (1994).
But what Goudschaal overlooks is the fact that she exercised her due process right to decide upon the care, custody, and control of her children and asserted her preference as a parent when she entered into the coparenting agreement with Frazier. If a parent has a constitutional right to make the decisions regarding the care, custody, and control of his or her children, free of government interference, then that parent should have the right to enter into a coparenting agreement to share custody with another without having the government interfere by nullifying that agreement, so long as it is in the best interests of the children. Further, as Nelson recognized, parental preference can be waived and, as Frazier points out, the courts should not be required to assign to a mother any more rights than that mother has claimed for herself.
Looking at the coparenting agreement from the other side, the children were third-party beneficiaries of that contract. They would have a reliance interest in maintaining the inherent benefits of having two parents, and severing an attachment relationship formed under that contract would not only risk emotional and psychological harm, as the NASW asserts, but also void the benefits to the children that prompted the agreement in the first instance. So what Goudschaal really wants is to renege on the coparenting agreement without regard to the rights of or harm to the children, all in the name of constitutionally protected parental rights. Surely, her constitutional rights do not stretch that far.
*754Indeed, we rejected the equivalent of Goudschaal’s effort in Ross. There, a mother permitted a presumptive father to develop a familial relationship with her child but then placed that relationship in jeopardy by seeking to have paternity testing. We refused to allow the mother to destroy the familial relationship she had permitted to develop between her child and the presumptive father, without a court first finding that it would be in the best interests of the child. In other words, notwithstanding the parental preference doctrine and tire biological parents’ constitutional rights, Ross required the district court to consider the rights and determine the best interests of the child before allowing the mother to get what she wanted. That rationale is equally compelling here. It is one thing to assert that a nonbiological, same-gender party to a coparenting agreement has to accept the state of the law at die time of contracting, but quite another to say that children who are the objects of that agreement must suffer the consequences of their biological mother’s change of heart. Before Goud-schaal can assert her parental rights to assuage her own psychological or emotional needs, she must convince the court that her proposed course of action is in the best interests of die children.
Moreover, as we have pointed out, without the coparenting agreement these children would have only one parent. See K.S.A. 38-1114(f) (semen donor not birth father). Denying the children an opportunity to have two parents, the same as children of a traditional marriage, impinges upon the children’s constitutional rights. Creation of the 1973 Uniform Parentage Act (UPA), 9B U.L.A. 377 (2001), upon which our KPA is based, was prompted in part by a series of United States Supreme Court cases that held that the Equal Protection Clause of the Fourteenth Amendment to the United States Constitution required that all children—both legitimate and illegitimate—be afforded equal treatment under the law. See, e.g., Gomez v. Perez, 409 U.S. 535, 537-38, 93 S. Ct. 872, 35 L. Ed. 2d 56 (1973); Weber v. Aetna Casualty & Surety Co., 406 U.S. 164, 173-76, 92 S. Ct. 1400, 31 L. Ed. 2d 768 (1972); Levy v. Louisiana, 391 U.S. 68, 70-72, 88 S. Ct. 1509, 20 L. Ed. 2d 436 (1968). The UPA drafters noted that “in providing substantive legal equality for all children regardless of the marital status *755of their parents, the [UPA] merely fulfills the mandate of the Constitution.” 9B U.L.A. 377 (2001) UPA (1973), Prefatoiy Note, p. 379. Accordingly, the constitutional rights of the children, as well as those of the parents, must inform our determination of the validity of a coparenting agreement. Here, the agreement effects equality by giving the children two parents. Moreover, the UPA and, in turn, the KPA are gender-neutral, so as to permit both parents to be of the same sex.
To summarize, the coparenting agreement before us cannot be construed as a prohibited sale of the children because the biological mother retains her parental duties and responsibilities. The agreement is not injurious to tire public because it provides the children with the resources of two persons, rather than leaving them as the fatherless children of an artificially inseminated mother. No societal interest has been harmed; no mischief has been done. Like the contract in Shirk, the coparenting agreement here contains “no element of immorality or illegality and did not violate public policy,” but rather “the contract was for the advantage and welfare of the child[ren].” See 186 Kan. 311, Syl. ¶ 7. Further, the agreement provides the children with “ ‘substantive legal equality . . . regardless of the marital status of their parents.' ” See Ross, 245 Kan. at 596 (quoting 9B U.L.A. 288-89 [1987]); K.S.A. 38-1112. Consequently, the coparenting agreement in this case does not violate public policy and is not unenforceable as a matter of law.
District Court’s Rulings
Because the coparenting agreement was enforceable, the district court had tire discretion to make appropriate orders addressing child custody, reasonable parenting time, and child support. Judicial action constitutes an abuse of discretion if it (1) is arbitrary, fanciful, or unreasonable; (2) is based on an error of law; or (3) is based on an error of fact. State v. Ward, 292 Kan. 541, Syl. ¶ 3, 256 P.3d 801 (2011), cert. denied 132 S. Ct. 1594 (2012).
We acknowledge that tire district court was exploring new territory in this case. Although it made the finding that its custody and parenting time orders were in the best interests of the children, we discern an absence of sufficient evidence to make that deter*756mination. For instance, the reason that the children allegedly began experiencing problems after recommencement of visitation with Frazier is unexplained in the record. Accordingly, we deem it appropriate to remand the case to further explore the best interests of the children and, in that regard, to appoint an attorney to represent the children’s interests.
With respect to the division of the parties’ property, the district court made a blanket finding that the parties intended to share everything. But, pursuant to Eaton v. Johnson, 235 Kan. 323, Syl. ¶ 2, 681 P.2d 606 (1984), the court should conduct an asset-by-asset determination of whether each item was “jointly accumulated by the parties or acquired by either with the intent that each should have an interest therein.” Accordingly, tire request of both parties to remand for a redetermination of the property division, utilizing the Eaton standard, is granted..
Affirmed in part and remanded with directions.
Bruce T. Gatterman, District Judge, assigned.# £ *