
93 Ill. App.3d 751 (1981)
417 N.E.2d 882
THOMAS PELHAM, a/k/a Thomas Ray, et al., Plaintiffs-Appellants,
v.
RONALD E. GRIESHEIMER, Defendant-Appellee.
No. 80-207.
Illinois Appellate Court  Second District.
Opinion filed February 27, 1981.
William E. Hartnett, of Waukegan, for appellants.
*752 Julian Johnson, of Snyder, Clarke, Dalziel, Holmquist & Johnson, of Waukegan, for appellee.
Judgment affirmed.
Mr. JUSTICE REINHARD delivered the opinion of the court:
This is an appeal by plaintiffs from a trial court order dismissing their amended complaint for attorney malpractice for failure to state a cause of action on the basis that there was no attorney-client relationship between the plaintiffs and defendant. We affirm.
Plaintiffs' amended complaint contains the following factual allegations: that the defendant was retained as attorney for Loretta Ray to obtain a divorce from George Ray; that plaintiffs herein were minor children of the parties at the time of the divorce; that the decree of divorce, entered on June 22, 1971, contained a provision requiring plaintiffs' father, George Ray, to "maintain all four of his children as the prime beneficiaries in his life insurance policies"; that plaintiffs' father, George Ray, was employed by Anchor Coupling Company of Liberty-ville, Illinois, prior to and after the divorce and was provided by his employer with a $10,000 life insurance policy; that subsequent to his divorce, plaintiffs' father, George Ray, married Mae Black Underwood and named her as the beneficiary of the life insurance policy issued through his employer in contravention of the terms of the divorce decree; that plaintiffs' father, George Ray, died on December 17, 1976, and that subsequent to his death Mae Black Underwood received the proceeds of said life insurance policy.
The amended complaint further alleges that defendant owed plaintiffs a duty to exercise a reasonable degree of professional care and that defendant breached that duty by failing to notify Anchor Coupling Company that the divorce decree required plaintiffs to be named as the prime beneficiaries on their father's life insurance policy, by failing to notify the life insurance company that plaintiffs were to be named as prime beneficiaries, by failing to advise plaintiffs that they had not been named as beneficiaries and by failing to advise plaintiffs' mother, Loretta Ray, to notify Anchor Coupling Company and the insurance carrier of the requirements of the divorce decree. Finally, plaintiffs' amended complaint states that as a direct and proximate result of defendant's alleged negligence, plaintiffs have suffered monetary damage in the amount of $10,000.
 1, 2 Loretta Ray is not a party to this lwsuit. The sole issue before us is whether the amended complaint alleges facts sufficient to state a cause of action in either contract or tort. While plaintiffs' amended complaint appears to be grounded in tort, we shall address briefly plaintiffs' contention on appeal that they qualify as third-party beneficiaries and are thereby entitled to recover for damages under a contractual theory. A *753 motion to dismiss for failure to state a cause of action is not properly granted if a good cause of action is stated, although not the one intended by plaintiffs. (Browning v. Heritage Insurance Co. (1975), 33 Ill. App.3d 943, 947, 338 N.E.2d 912, 915.) However, the amended complaint herein clearly fails to state a cause of action in contract as there are no allegations that a contract was entered into between defendant and Loretta Ray for the direct benefit of plaintiffs, which is an indispensable element of a third-party beneficiary theory of recovery. (People ex rel. Resnik v. Curtis & Davis (1980), 78 Ill.2d 381, 400 N.E.2d 918.) Therefore, if plaintiffs' amended complaint states a cause of action at all, it is in tort rather than contract.
 3 It is elementary that a motion to dismiss a complaint for failure to state a cause of action admits, for purposes of ruling thereon, all facts well pleaded. (Booker v. Board of Education (1979), 75 Ill. App.3d 381, 384, 394 N.E.2d 452.) Therefore, in reviewing the trial court's decision to dismiss plaintiffs' amended complaint for failure to state a cause of action, we consider as true all well pleaded facts, but for the sole purpose of determining whether, as a matter of law, those facts set forth a claim upon which relief may be granted. (Kenworthy v. Young (1979), 70 Ill. App.3d 144, 145, 388 N.E.2d 217.) To be legally sufficient, plaintiffs' complaint, like any other for negligence, must set out the following elements: (1) the existence of a duty owed by defendant to the plaintiffs; (2) breach of that duty, and (3) an injury proximately resulting from that breach. (Cunis v. Brennan (1974), 56 Ill.2d 372, 374; Mieher v. Brown (1973), 54 Ill.2d 539, 541; Public Taxi Service, Inc. v. Barrett (1976), 44 Ill. App.3d 452, 357 N.E.2d 1232.) Here plaintiffs seek to establish the existence of a legal duty owed to them by defendant and offer as support for their contention that by agreeing to represent plaintiffs' mother in her divorce proceeding, defendant assumed responsibility for protecting plaintiffs' legal rights relative to their care, custody, support and general welfare.
This issue of whether an attorney may be liable to a nonclient for damages allegedly incurred as a result of the attorney's negligent performance of his professional duties toward a client, while not one of first impression, has received scant attention in Illinois. The issue was addressed in a different context in Bloomer Amusement Co. v. Eskenazi (1979), 75 Ill. App.3d 117, 394 N.E.2d 16. In Eskenazi the contract seller of certain realty brought an action against the attorney for the contract purchaser alleging negligence in the attorney's failure to record the real estate contract. In affirming the trial court's grant of summary judgment for the attorney, the court referred to the United States Supreme Court decision in National Savings Bank v. Ward (1880), 100 U.S. 195, 25 L.Ed. 621, stating:
"According to the Supreme Court:

*754 `[T]he general rule is that the obligation of the attorney is to his client and not to a third party, and unless there is something in the circumstances of this case to take it out of that general rule, it seems clear that the proposition of the defendant must be sustained.' (National Savings Bank v. Ward (1880), 100 U.S. 195, 200, 25 L.Ed. 621, 623.)
According to the court, such circumstances that would make a case an exception to this general rule are `[c]ases where fraud and collusion are alleged * * *.' (National Savings Bank v. Ward (1880), 100 U.S. 195, 203, 25 L.Ed. 621, 624.) No such allegations were made by the plaintiff in the instant case, nor would they have been supported by any of the record." 75 Ill. App.3d 117, 119, 394 N.E.2d 16, 18.
Most recently, in Byron Chamber of Commerce, Inc. v. Long (1981), 92 Ill. App.3d 864, this court commented on the plaintiffs' action against a law partnership where there was no attorney-client relationship between them:
"Moreover, the apparent theory of the suit  that is, a class action suit based on breach of a contract for legal services for the benefit of third parties, raises, under the circumstances here, a serious question as to the alleged third parties' standing to sue. It is the general rule and the rule followed in Illinois that a contract for professional services between a lawyer and a client does not create a professional obligation between the lawyer and an unknown third party. Bloomer Amusement Co. v. Eskenazi (1979), 75 Ill. App.3d 117 and the numerous cases cited from other jurisdictions in Annot., 45 A.L.R. 3d 1187 (1972)." 92 Ill. App.3d 864, 868.
Plaintiffs, on the other hand, have failed to cite any Illinois cases which have extended an attorney's duty of care to nonclients, nor are we able to find any. While courts in several other states have held that attorneys may be liable for professional negligence to persons other than their clients, the cases so holding are distinguishable factually from the case at bar and typically have involved will-drafting situations where intended beneficiaries are damaged by an attorney's failure to fulfill the testamentary directions of his client. See Annot., 45 A.L.R. 3d 1181 (1972).
In Biakanja v. Irving (1958), 49 Cal.2d 647, 320 P.2d 16, a forerunner to subsequent attorney negligence cases, the California Supreme Court held that a notary public who had failed to have a will properly attested owed a duty of due care to an intended beneficiary of the testator and was liable to that intended beneficiary for damages caused by his negligence, despite a lack of privity of contract. In so holding, the court stated:
"The determination whether in a specific case the defendant will *755 be held liable to a third person not in privity is a matter of policy and involves the balancing of various factors, among which are the extent to which the transaction was intended to affect the plaintiff, the foreseeability of harm to him, the degree of certainty that the plaintiff suffered injury, the closeness of the connection between the defendant's conduct and the injury suffered, the moral blame attached to the defendant's conduct, and the policy of preventing future harm. Cf. Prosser, Torts (2d ed. 1955), §§ 36, 88, 107, pp. 168, 172, 544-545, 747; 2 Harper and James, Torts (1956), § 18.6, p. 1052." (49 Cal.2d 647, 650, 320 P.2d 16, 19.)
These factors subsequently were utilized by the California Supreme Court in holding that attorneys owe a duty of care to the intended beneficiaries of a client's will and that an attorney who errs in drafting a will may be held liable to the intended beneficiaries who are damaged, under either a contractual theory as third-party beneficiaries or under a tort theory of negligence. Lucas v. Hamm (1961), 56 Cal.2d 583, 364 P.2d 685, 15 Cal. Rptr. 821.
More recently, in Heyer v. Flaig (1969), 70 Cal.2d 223, 449 P.2d 161, 74 Cal. Rptr. 225, a negligence action was brought by the daughters of a deceased client against her attorney for failing to fulfill the testamentary directions of his client. The court held that the attorney owed a duty of reasonable care to the intended beneficiaries of the testatrix-client:
"Out of the agreement to provide legal services to a client, the prospective testator, arises the duty to act with due care as to the interests of the intended beneficiary." (70 Cal.2d 223, 229, 449 P.2d 161, 165, 74 Cal. Rptr. 225, 229.)
The court explained its rationale in recognizing such a duty as follows:
"We impose this duty because of the relationship between the attorney and the intended beneficiary; public policy requires that the attorney exercise his position of trust and superior knowledge responsibly so as not to affect adversely persons whose rights and interests are certain and foreseeable." (70 Cal.2d 223, 229, 449 P.2d 161, 165, 74 Cal. Rptr. 225, 229.)
We note that in these will-drafting cases the sole purpose of retaining the attorney is to directly benefit a known third party or parties.
 4 While there are no Illinois decisions dealing with the precise issue before us, i.e., whether under certain circumstances an attorney's duty of care extends to the minor children of a divorce client, there are numerous cases analyzing the concept of duty in other contexts. It is clear, first of all, that the question of whether the defendant and the plaintiff stand in such a relationship to one another that the law will impose upon the defendant an obligation of reasonable conduct for the plaintiff's benefit is one of law for determination by the court. (Cunis v. Brennan (1974), 56 Ill.2d 372, *756 374; Mieher v. Brown (1973), 54 Ill.2d 539, 541.) The determination of the duty question requires the court to weigh several factors, such as the foreseeability of the occurrence, the likelihood of injury, the magnitude of the burden of guarding against it and the consequences of placing that burden upon the defendant. Cross v. Chicago Housing Authority (1979), 74 Ill. App.3d 921, 393 N.E.2d 580; Dezort v. Village of Hinsdale (1976), 35 Ill. App.3d 703, 342 N.E.2d 468.
While the injury which befell plaintiffs was reasonably likely and foreseeable given allegations of defendant's failure to take steps to insure compliance with the insurance provision of the divorce decree, and while the burden of guarding against the injury is not oppressive, we feel that placing that burden on defendant, and other attorneys in this State, would lead to undesirable consequences, not the least of which would be potential conflicts of interest between an attorney and his client and less than vigorous representation of the client. In Berlin v. Nathan (1978), 64 Ill. App.3d 940, 381 N.E.2d 1367, the court expressed similar fears in holding that it would be contrary to public policy to rule that an attorney has a duty to an intended defendant not to file a "weak" lawsuit against him.
In dissolution proceedings, the legal rights of several parties often are affected, i.e., a husband, a wife and one or more children, and it is not uncommon that one or more of those parties may lack the benefit of legal counsel. In that type of situation, there is already an ever-present danger that a conflict of interest will arise. Were we to conclude that an attorney representing one of the spouses (or conceivably opposing attorneys representing each spouse) also owes a duty of reasonable care to the minor children of the parties despite a lack of privity of contract, we only would serve to increase the likelihood of such a conflict as, for example, between a minor's right to support versus that spouse's interest in the property and maintenance. In those cases where it does appear that the interests of the minor require separate representation, we would point out that section 506 of the Illinois Marriage and Dissolution of Marriage Act (Ill. Rev. Stat. 1979, ch. 40, par. 101 et seq.) provides for representation of minor children:
"The court may appoint an attorney to represent the interests of a minor or dependent child with respect to his support, custody and visitation. The court shall enter an order for costs, fees and disbursements in favor of the child's attorney. The order shall be made against either or both parents, or against the child's separate estate." (Ill. Rev. Stat. 1979, ch. 40, par. 506.)
While, admittedly, plaintiffs did not have the benefit of the above provision, which became effective October 1, 1977, courts always have possessed inherent equitable power (Flynn v. Flynn (1918), 283 Ill. 206, *757 119 N.E. 304) as well as statutory authority (Ill. Rev. Stat. 1979, ch. 110, par. 356) to appoint a guardian ad litem for minors. (Ill. Ann. Stat., ch. 40, par. 506, Historical and Practice Notes, at 630 (Smith-Hurd 1980).) Under such provisions, the rights of minor children of the parties can be protected, thus avoiding the fate which befell plaintiffs, without compromising the undivided loyalty of a spouse's attorney. While it is unfortunate that a guardian ad litem was not appointed to protect plaintiffs' interests when they were minors, practical realities often preclude such appointment.
 5 Finally, we would point out that the line of out-of-State cases extending an attorney's duty to nonclients appears to be limited to a narrow range of factual situations wherein the client's sole purpose in retaining an attorney is to benefit directly some third party or parties, such as intended beneficiaries under a will. (Heyer v. Flagg; Lucas v. Hamm.) Such is not the factual situation in the present case. Clearly, plaintiffs' mother retained defendant for the primary purpose of representing her own interests in a divorce proceeding. Any intention of plaintiffs' mother to confer benefits on plaintiffs could be described as incidental or collateral. Under the facts as pleaded, we hold that there is no duty owed by the attorney to his client's children; hence, no cause of action accrues to them. In view of this disposition of the case, it is unnecessary for us to determine whether the various allegations of negligence against the defendant are legally sufficient.
Accordingly, we conclude that the trial court did not err in dismissing plaintiffs' amended complaint for failure to state a cause of action.
Affirmed.
UNVERZAGT and LINDBERG, JJ., concur.
