The State of Nebraska brings this paternity action on behalf of Gabriel Kole Dunn, a minor, to establish David J. Wiegand, the respondent, as Gabriel’s father. In the petition, the State prayed for a monthly allowance for the child’s support; for an order requiring Wiegand to provide medical insurance coverage; “for the reasonable hospital, medical, and surgical expenses from and after the birth of said child in the amount of $10,948.67”; for attorney fees; and for other relief. After a pretrial conference, the court determined paternity, ordered child support and health insurance coverage, and granted judgment against Wiegand in the amount of $10,948.67. Wiegand appeals only that portion of the order which awards judgment against him for $10,033.31 of the $10,948.67, that is, for the medical expenses of the child’s mother, Dawn Dunn, before the child’s birth. We reverse that portion of the decree appealed.
TRIAL COURT PROCEEDINGS
The petition is captioned “State of Nebraska, on behalf of Gabriel Kole Dunn, a minor child, Petitioner, v. David J. Wiegand, [Social Security number,] Respondent.” The petition states that the action is brought by a special deputy county attorney under Neb. Rev. Stat. §§ 43-512.03(l)(d) (Cum. Supp. *5821992) and 43-1401 et seq. (Reissue 1988 & Cum. Supp. 1992). The petition states the residence of the child and his parents; that the mother gave birth to the child on March 25, 1991; that Wiegand is the child’s father; and that the parents have never been married to each other. The State then alleges the child is in need of support, that Wiegand has failed to provide support, and that Wiegand is capable of supporting the child and providing medical insurance for him. The petition also asserts that the State is currently providing support for the child in the form of aid to dependent children and other benefits.
The only allegation by the State bearing upon medical expenses is that “respondent is capable of paying for the hospital, doctor, medical, and other expenses incurred for the prenatal care, birth and physical needs of said child since birth.” There are no other allegations concerning medical expenses of the child or of the mother before or after the birth. In the prayer, in addition to a request for determination of paternity and support, there is a request “for the reasonable hospital, medical, and surgical expenses from and after the birth of said child in the amount of $ 10,948.67.”
Wiegand demurred to the petition on the basis that there was a defect of the parties plaintiff, that the State did not have the capacity to sue for medical expenses for any person other than the child, and that the petition did not state facts sufficient to constitute a cause of action for hospital, medical, and surgical expenses of $10,948.67. The demurrer was overruled. Thereafter, Wiegand filed his answer and admitted the birth of the child and the residence of the parties, but denied other allegations in the petition. He again alleged the same three points raised by the demurrer.
On January 17,1992, a pretrial conference was held. There is no pretrial order or report in the record, but at that hearing the parties entered into stipulations, summarized below, and immediately thereafter the court entered the judgment that is being appealed.
The parties stipulated to paternity and to a worksheet which demonstrated the propriety of the support award of $255 per month, to commence on the first of the month following the order. The parties also stipulated that exhibit 1 shows medical *583expenses totaling $915.36, that these expenses were necessarily incurred as a result of the child’s birth, and that the expenses were fair and reasonable. They further stipulated that the expenses on exhibit 2, totaling $10,033.31, were necessarily incurred as a result of the mother’s pregnancy and that these expenses were fair and reasonable. Wiegand agreed that the State incurred $915.36 in expenses on behalf of the child and $10,033.31 on behalf of the mother.
The parties agreed that the court could enter its order immediately on the basis of the stipulations made at the pretrial conference. The court then found and ordered that Wiegand was the child’s father, that Wiegand was to pay $255 per month for the child’s support, and that Wiegand must maintain medical and hospitalization insurance on the child if such insurance was available through his employer or subsequent employers. Wiegand has no complaint regarding that part of the order.
In addition to the order issued at the hearing, the operative written order provided:
Judgment is hereby entered against respondent for $10,033.31 for medical expenses incurred by [the mother] and judgment is entered accordingly against respondent. The fair and reasonable medical expenses incurred by [the child] at his birth and paid by the State of Nebraska Department of Social Services was [sic] $915.36. Respondent has consented to a judgment being entered against him for $915.36 for birth related medical expenses of [the child] and judgment is entered accordingly against respondent.
ASSIGNMENTS OF ERROR
Wiegand alleges the trial court committed error (1) in entering judgment for $10,033.31 for medical expenses incurred by the child’s mother when she was not a party and when the State presented no evidence showing any right to bring such an action on behalf of the mother; (2) by abusing its discretion in awarding judgment of $10,033.31 when the mother was not a party to the action; and (3) in awarding judgment for $10,033.31 on behalf of the mother as the claim *584was not properly before the court. These assignments raise two questions: (1) Does the petition state a cause of action for the $10,033.31 in medical expenses included in the judgments? and (2) Is the plaintiff the real party in interest for collection of these medical expenses?
STANDARD OF REVIEW
The only issues raised are issues of law. On matters of law, an appellate court has the obligation to reach an independent conclusion, irrespective of the determination made by the court below. State v. Quandt, 234 Neb. 402, 451 N.W.2d 272 (1990).
MEDICAL EXPENSE ALLEGATIONS
We start by observing that insofar as the medical expenses are concerned, the State simply ignores clear statutory law and case law in several respects. Neb. Rev. Stat. § 25-804 (Reissue 1989) provides, in significant part, the following:
The petition must contain (1) the name of the court and county in which the action is brought, and the names of the parties, plaintiff and defendant; (2) a statement of the facts constituting the cause of action, in ordinary and concise language, and without repetition; and (3) a demand for... relief____
“It is elementary that a judgment must be supported by the pleadings.” Harrison v. Grizzard, 192 Neb. 243, 245, 219 N.W.2d 766, 768 (1974). A judgment of personal liability must be supported by a pleading alleging it as a cause of action. Glissmann v. Orchard, 152 Neb. 500, 41 N.W.2d 756 (1950). A petition that does not state a cause of action will not support a judgment rendered thereon. Hague v. Sterns, 175 Neb. 1, 120 N.W.2d 287 (1963). At the very least, to recover medical expenses in any case, § 25-804 and the above cases require that the plaintiff allege facts which if true would establish that the claimed medical expenses were incurred by someone, the amount of the medical expenses, that the expenses were fair and reasonable, and such additional facts as might be necessary under the law to make the defendant responsible to the plaintiff for them. Since the petition contains no such allegations, it does not state a cause of action for medical expenses.
*585OWNERSHIP OF RIGHT TO RECOVER MEDICAL EXPENSES
Section 43-1407 provides:
The father of a child shall also be liable for the reasonable expenses of the mother of such child during the period of her pregnancy, confinement and recovery. Such liability shall be determined and enforced in the same manner as the liability of the father for the support of the child.
Section 43-1407 says the father shall be liable, but does not say to whom he is liable. These expenses were once called lying-in expenses, and the mother of the child could always recover them, even when the child was adopted or died. Bolich v. Robinson, 106 Neb. 449, 184 N.W. 218 (1921); Hanisky v. Kennedy, 37 Neb. 618, 56 N.W. 208 (1893). By statute, “all expenses associated with the birth of a child,” are now included within the term “medical support.” Neb. Rev. Stat. 43-512(6)(b) (Cum. Supp. 1992). The Supreme Court recently held that it is the mother or her assignee, not the child, who holds the right to recover “ ‘medical expenses incurred in relation to the pregnancy, confinement and recovery ....’” State on Behalf of S.M. v. Oglesby, 244 Neb. 880, 884, 510 N.W.2d 53, 56 (1994).
Therefore, it is the mother, not Gabriel, who holds the right to recover for the medical expenses incurred by his mother, and therefore the State has failed to properly state a claim for such expenses.
With proper allegations and proof, the father would be liable to the mother of the child born out of wedlock for all of the expenses associated with the birth of the child. Perhaps the father could be liable to others, such as the mother’s parents, but there is no basis for holding that the father is liable to the child born out of wedlock for the medical expenses the mother incurred before the child’s birth. (The defendant does not question the child’s right to recover the cost of his birth, and therefore we are not considering this question.) There is no allegation of fact showing how the mother was divested of her right to recover these expenses.
Of course, with proper allegations and proof, the right to recover medical support from the father could be acquired by a *586third party. The State, acting through the Department of Social Services (DSS), is the obvious entity to acquire this right. Neb. Rev. Stat. § 68-716 (Reissue 1990) provides:
An application for medical assistance benefits shall give a right of subrogation to the Department of Social Services. Subject to sections 68-1038 to 68-1043, subrogation shall include every claim or right which the applicant may have against a third party when such right or claim involves money for medical care. The third party shall be liable to make payments directly to the Department of Social Services as soon as he or she is notified in writing of the valid claim for subrogation under this section.
Neb. Rev. Stat. § 68-1026 (Reissue 1990) provides for an automatic assignment under very similar circumstances. The Nebraska Supreme Court has held that for the assignment to be effective, in addition to the application for medical benefits, the State must also pay or become obligated to pay the medical expenses. Ehlers v. Perry, 242 Neb. 208, 494 N.W.2d 325 (1993). Therefore, it would appear that if an expectant mother or a mother makes application to DSS for medical assistance, and DSS pays or becomes obligated to pay her lying-in expenses, the father becomes obligated to DSS for those expenses when DSS notifies the father in writing of the claim. The petition does not contain allegation justifying recovery by the State under § 68-1026 or § 68-716.
Neb. Rev. Stat. § 43-512.07 (Cum. Supp. 1992) provides in part:
The application for and acceptance of an aid to dependent children payment by a parent, another relative, or a custodian shall constitute an assignment by operation of law to [DSS] of any right to spousal or medical support when ordered by the court and to child support whether or not ordered by the court which the recipient may have in his or her own behalf or on behalf of any other person for whom the applicant receives such assistance, including any accrued arrearage as of the time of the assignment. [DSS] shall be entitled to retain such support up to the amount of aid to dependent children paid to the recipient.
(Emphasis supplied.)
*587As stated above, the medical expenses of caring for a mother during pregnancy are medical support. However, under § 43-512.07 these expenses are assigned to DSS only “when ordered by the court.” Therefore, before the petition would state facts showing DSS acquired the mother’s rights to recover these expenses under § 43-512.07, the plaintiff would need to allege that the mother made application for and acceptance of aid to dependent children payments and that medical support was court-ordered.
The petition does not allege these facts, and therefore the petition does not state a cause of action which entitles the State to these expenses under § 43-512.07.
WHO IS THE PARTY PLAINTIFF?
The prayer of the petition did not clearly ask for a judgment in favor of the State and against Wiegand, and the court’s order gave a judgment against Wiegand, but did not provide in whose favor the judgment was granted. This deficiency reveals another problem with this case, that is, the confusion as to what legal entity is the party plaintiff.
The State alleges it brings this action on behalf of the child under §§ 43-512.03 and 43-1401 et seq. Section 43-512.03 provides:
The county attorney or authorized attorney shall:
(a) On request by [DSS] as described in subsection (2) of this section or when the investigation or application filed under section 43-512 or 43-512.02 justifies, file a petition against a nonsupporting parent or stepparent... praying for an order for child or medical support in cases when there is no existing child or medical support order.
While this statute requires the county attorney to bring the action, it does not provide in whose name it is to be brought.
Section 43-1406 provides that the father of a child
may be made the defendant in an equitable proceeding for the support of the child. . . . Such proceeding shall be commenced by a complaint of the mother of the child ... the state when required to support the child, the county attorney, or an authorized attorney as defined in section 43-512.
*588Additionally, § 43-1411 provides, in relevant part: “A civil proceeding... may be instituted... by (1) the mother or... (2) the guardian or next- friend of such child or the state, either during pregnancy or within eighteen years after the child’s birth.” It appears that these statutes allow the county attorney to bring an action for child and medical support either in the name of the State for DSS or in the name of the child. Perhaps the county attorney could bring such actions in the name of both. What legal entity is the plaintiff in this action?
In the present case, the State alleges it brings this action “on behalf of Gabriel Kole Dunn.” “Every action must be prosecuted in the name of the real party in interest, except as otherwise provided in section 25-304.” Neb. Rev. Stat. § 25-301 (Reissue 1989). In ascertaining whether the plaintiff is the real party in interest, the primary and fundamental test to be applied is whether prosecution of the action will save the defendant from further harassment or vexation at the hands of other claimants to the same demand. If the defendant is not cut off from any just defense, offset, or counterclaim against the demand, and a judgment on behalf of the party suing will fülly protect him when discharged, then is his concern at an end. County of Polk v. Wombacher, 229 Neb. 239, 426 N.W.2d 266 (1988). Neb. Rev. Stat. § 25-304 (Reissue 1989) provides for the traditional representative, such as an executor or “a person expressly authorized by statute,” to bring an action without joining the person for whose benefit it is being prosecuted. The above quoted statute appears to expressly authorized the action to be brought by the State.
“The character in which one is made a party to a suit, and the capacity in which a party sues or is sued, must be determined from the allegations of the pleadings, and not from its title alone.” 67A C.J.S. Parties § 117 at 939 (1978). There are no allegations of fact which would support that the State is suing in its own right, although there are allegations which justify the State bringing the action. The name of the case, the allegations in the petition, and the statutes allowing the State to bring this action on behalf of the child, all support the conclusion that this action is an action by the State on behalf of *589the child to establish paternity and seek support, and not an action in its own right.
A petition which shows in substance that a plaintiff is suing by his next friend is sufficient. The next friend is neither technically nor substantially a party, and a suit by a next friend should be brought in the name of the real party in interest, described as suing by his next friend. A suit by a party for the benefit of minors is in reality a suit by such person as the next friend of the minors.
(Emphasis supplied.) 67A C. J. S., supra, § 119 at 942.
“[W]here suit is brought by a nominal party for the benefit of another party, the beneficiary is the real party in interest and must be considered the sole party of record.” 59 Am. Jur. 2d Parties § 36 at 429 (1987). “A person acting in two different capacities is really two separate and distinct entities. Accordingly, such a person must be made a party in the capacity or capacities in which it is desired to bind him.” 67A C.J.S., supra, % 117 at 940.
We conclude that the petition does not allege facts which show the State is a party to this action.
CONCLUSION
In conclusion, the trial court’s judgment must be reversed for the following reasons: (1) The petition does not state a cause of action for the mother’s medical expenses; (2) it is the mother, not the child, who holds the right to recover for the medical expenses incurred by his mother, and because the State bases its claim on behalf of the child, it has failed to properly state a claim for such expenses; (3) there are no factual allegations to justify a finding that the State was assigned or was subrogated to the rights of the mother; and (4) the State is not a party to this action in its own right. For these reasons, the judgment against Wiegand is reversed, and the cause remanded with directions to set aside the judgment of $10,948.67 and enter judgment in favor of the State and against Wiegand in the amount of only $915.36 plus the costs of this action.
Reversed and remanded with directions.