
582 N.E.2d 108 (1991)
144 Ill.2d 535
163 Ill.Dec. 842
Johnnie C. GOUGE et al., Appellees,
v.
CENTRAL ILLINOIS PUBLIC SERVICE COMPANY, Appellant.
No. 70291.
Supreme Court of Illinois.
September 19, 1991.
Rehearing Denied December 2, 1991.
*110 Sorling, Northrup, Hanna, Cullen & Cochran, Ltd., (R. Gerald Barris and John A. Kauerauf, of counsel) Springfield, Bleyer & Bleyer, (James B. Bleyer, of counsel) Marion, for appellant.
Rammelkamp, Bradney, Dahman, Kuster, Keaton, & Fritsche P.C. (Forrest G. Keaton, of counsel) Jacksonville, Michael Beer, Decatur, for amicus curiae Soyland Power Co-op., Inc.
Gerald J. Porento, Hugh C. Griffin, and Diane I. Jennings, Lord, Bissell & Brook, and Stuart J. Albert, Chicago, for amicus curiae Com. Edison Co. et al.
Douglas G. Brown, Springfield, for amicus curiae Ill. Mun. Elec. Agency.
Brad L. Badgley, Heiligenstein & Badgley, P.C., Belleville, for appellees.
*109 Justice CLARK delivered the opinion of the court:
Plaintiffs, Johnnie and Vicki Gouge, filed a two-count second-amended complaint in the circuit court of Franklin County against defendant, Central Illinois Public Service Company (CIPS). In count I, Johnnie Gouge sought damages for personal injuries he suffered when his automobile struck a utility pole owned by CIPS. In count II, Vicki Gouge sought damages for loss of consortium. Upon CIPS's motion, the circuit court dismissed plaintiffs' second-amended complaint for failure to state a cause of action. The appellate court reversed and held that the second-amended complaint stated a cause of action for "negligent installation of the utility pole." (195 Ill.App.3d 1026, 1032, 142 Ill.Dec. 563, 552 N.E.2d 1304.) CIPS filed a petition for leave to appeal, which this court denied on October 3, 1990. On November 21, 1990, this court allowed CIPS's motion for leave to file a motion for reconsideration and vacated our October 3, 1990, order. Subsequently, we allowed CIPS's petition for leave to appeal (134 Ill.2d R. 315). Amicus curiae briefs in support of CIPS's petition for leave to appeal were filed by Soyland Power Cooperative, Inc., Illinois Municipal Electric Agency, Commonwealth Edison Company, Central Illinois Light Company, Illinois Power Company, Illinois Bell Telephone Company, and Union Electric Company.
At approximately 1 a.m. on August 7, 1986, Johnnie Gouge was driving his automobile south on Janette Street, in Browning Township, Franklin County. As Gouge approached a sharp curve to his right, he lost control of his vehicle, skidded 65 feet and left the paved surface of the road. After crossing a gravel shoulder, Gouge's automobile struck a wooden utility pole owned by CIPS. The utility pole was approximately 15 feet from the paved surface of Janette Street, and had attached to its top portion a 7,200 volt transformer which was apparently filled with a flammable substance. Upon impact, the utility pole fractured 10 to 12 feet above ground. The top portion of the pole with the transformer attached fell onto Gouge's automobile and through the windshield. The transformer broke open and the flammable substance spilled out and ignited. Gouge suffered severe, permanent and disabling injuries from the fire.
Plaintiffs' second-amended complaint alleges that CIPS was negligent in the installation of the wooden utility pole. Specifically, plaintiffs assert:
"a) Contrary to ANSI [American National Standards Institute] C2, National Electric Safety Code, Rule 261C and 282A, [CIPS] installed and/or permitted to remain in place, the aforesaid pole with a guy wire attached to the accident pole that was out of line with the strain from the wires coming across the road from the takeoff pole to the accident pole;
b) [CIPS] failed to add a second wire to the accident pole alongside the fencerow at the scene of the occurrence, extending away from the road;

*111 c) [CIPS] failed to place a single guy wire in line with the wires coming across the road from the take-off pole."
CIPS filed a motion to dismiss plaintiffs' second-amended complaint arguing that it failed to state a cause of action as matter of law. CIPS contended that the complaint failed to allege sufficient facts to adequately plead an essential element for a cause of action for negligence, i.e., a duty on the part of CIPS owed to plaintiffs under the circumstances alleged. CIPS argued that it was not reasonably foreseeable that Gouge would leave the roadway and strike this particular utility pole. CIPS relied primarily on two cases which state that utility companies owe no duty to motorists in terms of the placement of utility poles because it is not reasonably foreseeable that a motorist in the ordinary course of travel would leave the traveled portion of the roadway and strike that utility pole. (See Boylan v. Martindale (1982), 103 Ill. App.3d 335, 59 Ill.Dec. 43, 431 N.E.2d 62; Hoffman v. Vernon Township (1981), 97 Ill.App.3d 721, 53 Ill.Dec. 135, 423 N.E.2d 519.) The circuit court agreed and granted CIPS's motion to dismiss.
The appellate court reversed. The appellate court acknowledged that a utility company generally owes no duty for the placement of utility poles to motorists who deviate from the roadway and strike a utility pole. However, the appellate court believed that this case was different because plaintiffs were not suing CIPS for negligent location of the utility pole, but rather for negligent installation of the utility pole. (195 Ill.App.3d at 1030, 142 Ill.Dec. 563, 552 N.E.2d 1304.) In analyzing whether CIPS owed a duty to plaintiffs to exercise reasonable care in the installation of the utility pole, the appellate court concluded that "it is foreseeable that an improperly guyed utility pole may fracture and fall or may simply topple over, whether from weather conditions, strain from other wires running from the pole, the passage of time or collision with an automobile." (195 Ill.App.3d at 1031, 142 Ill.Dec. 563, 552 N.E.2d 1304.) Further, the appellate court stated that the magnitude of guarding against this harm is not great because CIPS need only "properly guy those utility poles which reasonable care dictates require guy wires." (195 Ill. App.3d at 1031, 142 Ill.Dec. 563, 552 N.E.2d 1304.) As a result, the appellate court held that plaintiffs' second-amended complaint stated a cause of action for negligent installation of the utility pole.
Initially, we note that CIPS's motion to dismiss was filed pursuant to section 2-619(a)(9) of the Code of Civil Procedure (Ill.Rev.Stat.1989, ch. 110, par. 2-619(a)(9)). Section 2-619(a)(9) provides that a defendant may file a motion for dismissal alleging "[t]hat the claim asserted against defendant is barred by other affirmative matter avoiding the legal effect of or defeating the claim." In the present case defendant's motion was based on a failure to state a cause of action upon which relief could be granted. Given that CIPS's motion to dismiss challenged the legal sufficiency of the complaint, as opposed to asserting an affirmative defense, CIPS's motion should have been filed pursuant to section 2-615 of the Code (Ill.Rev.Stat. 1989, ch. 110, par. 2-615). However, since plaintiffs have not been prejudiced by this error, we will treat CIPS's motion as if it had been filed as a section 2-615 motion to dismiss. (See B.C. v. J.C. Penney Co. (1990), 205 Ill.App.3d 5, 12, 150 Ill.Dec. 3, 562 N.E.2d 533.) A cause of action will not be dismissed on the pleadings unless it clearly appears that no set of facts can be proved which will entitle plaintiffs to recover. (Charles Hester Enterprises, Inc. v. Illinois Founders Insurance Co. (1986), 114 Ill.2d 278, 286, 102 Ill.Dec. 306, 499 N.E.2d 1319.) In making this determination, we must take all well-pleaded facts as true, and all reasonable inferences therefrom should be construed in plaintiffs' favor. Katz v. Belmont National Bank (1986), 112 Ill.2d 64, 67, 96 Ill.Dec. 697, 491 N.E.2d 1157.
To state a cause for negligence, a complaint must allege facts sufficient to show the existence of a duty, a breach of that duty, and injury to the plaintiff which is proximately caused by that breach. (Ziemba v. Mierzwa (1991), 142 Ill.2d 42, *112 45, 153 Ill.Dec. 259, 566 N.E.2d 1365.) Whether a duty exists is a question of law to be determined by the court, and depends on whether the parties stood in such a relationship to one another that the law imposes an obligation on the defendant to act reasonably for the protection of the plaintiff. (Kirk v. Michael Reese Hospital & Medical Center (1987), 117 Ill.2d 507, 525, 111 Ill.Dec. 944, 513 N.E.2d 387.) In considering whether a duty exists in a particular case, a court must weigh the foreseeability of the injury, the likelihood of the injury, the magnitude of the burden of guarding against it and the consequences of placing that burden on the defendant. (Kirk, 117 Ill.2d 507, 111 Ill.Dec. 944, 513 N.E.2d 387; Lance v. Senior (1967), 36 Ill.2d 516, 518, 224 N.E.2d 231.) In terms of foreseeability, the court will consider whether the risk of harm to the plaintiff was reasonably foreseeable. Cunis v. Brennan (1974), 56 Ill.2d 372, 376, 308 N.E.2d 617.
In their second-amended complaint, plaintiffs rely on two rules of the National Electric Safety Code to support their claim that CIPS owed a duty to plaintiffs to properly install guy wires to the utility pole which Gouge's automobile struck. In their brief to this court, plaintiffs assert that CIPS "voluntarily assumed the burden to guard against an injury of this nature by implementing Section 261C and 282A of the National Electrical Safety Code." In addition, plaintiffs argue in their brief that under Illinois Commerce Commission General Order 160, CIPS had a duty to install the pole "in accordance with accepted good practice, given local conditions and all particulars not specified in the rules." Plaintiffs maintain that these rules create a duty on the part of CIPS to properly guy the utility pole so that it would have fallen "away from the roadway," rather than onto Gouge's automobile.
In order to recover for a defendant's violation of a statute or rule designed to protect human life or property, a plaintiff must show: (1) the violation proximately caused the injury; (2) plaintiff belonged to the class of persons whom the rule was intended to protect from injury; (3) the kind of injury suffered by plaintiff was the kind of injury which the rule sought to prevent. (Dunn v. Baltimore & Ohio R.R. Co. (1989), 127 Ill.2d 350, 367, 130 Ill.Dec. 409, 537 N.E.2d 738, citing Barthel v. Illinois Central Gulf R.R. Co. (1978), 74 Ill.2d 213, 219-20, 23 Ill.Dec. 529, 384 N.E.2d 323.) Because plaintiffs cannot show the cited rules were intended to protect against this type of injury, we disagree with plaintiffs' contention that CIPS owed them a duty to properly install the utility pole pursuant to Rules 261C and 282A of the National Electric Safety Code. Generally, these rules prescribe the industry standards for the use and placement of guy wires on utility poles. Guy wires are used to prevent utility poles from falling under their own weight, or from the strain of wind, ice or other natural conditions. As CIPS points out in its brief to this court, the guy wires are not intended to cause the utility pole to fall in a certain direction if it is struck by an automobile. Plaintiffs do not contest that these rules are intended to protect only against weather loading such as wind and ice. Rather, plaintiffs argue that CIPS is under a general mandate from the Illinois Commerce Commission to ensure that its utility poles are properly guyed. Since the purpose of guy wires is not to cause a utility pole to fall in a certain direction when struck by an automobile deviating from the traveled portion of a roadway, we conclude that Johnnie Gouge was not in the class of persons whom the rules intended to protect from injury. Thus, we do not find a duty on the part of CIPS based on these rules.
We also find that CIPS does not owe plaintiffs a common law duty of reasonable care to ensure that if an automobile leaves the traveled portion of a roadway and strikes a utility pole, the pole will fall "away from the roadway." Generally, the liability of a utility company for injuries to a motorist resulting from a collision with a utility pole "depends on whether the pole is located in or so close to the traveled portion of the highway, or is maintained in such a manner, as to constitute an obstruction dangerous to anyone properly using *113 the highway." (39 Am.Jur.2d Highways, Streets, & Bridges § 459 (1968); Annot., 51 A.L.R.4th 602 (1987); McMillan v. Michigan State Highway Comm'n (1983), 130 Mich.App. 630, 344 N.W.2d 26.) In addition, our appellate court has held that utility companies owe no duty to motorists who collide with utility poles unless it is reasonably foreseeable that the vehicles would leave the roadway in the ordinary course of travel and strike the utility poles. See Boylan, 103 Ill.App.3d 335, 59 Ill.Dec. 43, 431 N.E.2d 62; Hoffman, 97 Ill.App.3d 721, 53 Ill.Dec. 135, 423 N.E.2d 519.
Both Boylan and Hoffman relied on section 368 of the Restatement (Second) of Torts, which involves the liability of owners or occupiers of land for artificial conditions created thereon which cause injury to travelers on an adjacent highway. Section 368 states:
"A possessor of land who creates or permits to remain thereon an excavation or other artificial condition so near an existing highway that he realizes or should realize that it involves an unreasonable risk to others accidentally brought into contact with such condition while traveling with reasonable care upon the highway, is subject to liability for physical harm thereby caused to persons who
(a) are traveling on the highway, or
(b) foreseeably deviate from it in the ordinary course of travel." (Emphasis added.) Restatement (Second) of Torts § 368 (1965).
In this case, the utility pole in question was located approximately 15 feet from Janette Street. Plaintiffs have not alleged that the utility pole in question was an obstruction dangerous to anyone properly driving on Janette Street. Further, plaintiffs have alleged no facts in their complaint, nor are any facts apparent, which would indicate that it was reasonably foreseeable that Gouge would deviate from Janette Street and strike this utility pole. As the appellate court stated in Boylan:
"It is common knowledge that vehicles collide in roadways and on occasion leave the roadway and strike a utility pole or tree adjacent to the roadway. However, for a duty to third persons to be imposed upon those who erect and maintain such utility poles, there must be reasonable anticipation of such deviation from the roadway as a normal incident of travel." (Boylan, 103 Ill.App.3d at 346, 59 Ill.Dec. 43, 431 N.E.2d 62.)
(Restatement (Second) of Torts § 368 (1965); Hoffman, 97 Ill.App.3d 721, 53 Ill. Dec. 135, 423 N.E.2d 519.) Since it was not reasonably foreseeable that Gouge would strike this utility pole, we do not believe CIPS owed a duty to plaintiffs to ensure that the pole would fall "away from the roadway" when struck by Gouge's automobile.
The appellate court and the plaintiffs in this case emphasize that the Boylan and Hoffman cases are inapplicable because they deal with claims for the negligent placement of a utility pole as opposed to the negligent installation of the utility pole. Further, they argue that for liability to attach, it is not necessary that the exact method by which the injury occurred could have been expected, but rather it is sufficient if some resulting injury could have been reasonably foreseen. (195 Ill.App.3d at 1031, 142 Ill.Dec. 563, 552 N.E.2d 1304, citing Blue v. St. Clair Country Club (1955), 7 Ill.2d 359, 364, 131 N.E.2d 31.) This analysis is deceiving. Presently, we are confronted with the issue of whether utility companies owe a duty for the installation of the utility pole to motorists who deviate from the traveled portion of a roadway and strike a utility pole. This issue is answered, in part, by whether it is reasonably foreseeable that a motorist will deviate from the roadway in the ordinary course of travel and strike that utility pole. (See Cunis v. Brennan (1974), 56 Ill.2d 372, 375, 308 N.E.2d 617 (stating that the existence of a legal duty, while ordinarily considered in terms of foreseeability, is not bottomed on the factor of foreseeability alone).) If it is not reasonably foreseeable that a motorist will leave the traveled portion of a roadway and strike a particular utility pole, we do not believe that the utility company owes a duty to that motorist to maintain that pole in such a condition as to prevent an injury from the impact of *114 the automobile. Thus, the question of the liability of a utility company, which the appellate court addressed, presumes that a duty on the part of the utility company to maintain that pole for the benefit of the motorist had previously been found.
We also disagree with plaintiffs' contention that utility companies are being granted "virtual immunity in the installation of its electrical energized power poles and transformers along the roadways of the State of Illinois." Utility companies do have a duty to exercise reasonable care in the installation and maintenance of their utility poles. CIPS owed a duty to properly guy its utility poles so that, for instance, they would not fall onto a roadway, smashing an automobile and injuring the driver. This duty is not being diminished. Nonetheless, CIPS does not owe a duty to motorists who unforeseeably deviate from the traveled portion of the roadway and strike a utility pole located 15 feet from the roadway. As stated in Dunn v. Baltimore & Ohio R.R. Co. (1989), 127 Ill.2d 350, 366, 130 Ill.Dec. 409, 537 N.E.2d 738:
"The law imposes a duty on all persons to exercise ordinary care. We believe that the imposition of a general duty to anticipate and guard against the negligence of others would place an intolerable burden on society."
Other factors which courts use to determine if a defendant owes a duty to a plaintiff persuade us that CIPS does not owe a duty to plaintiffs in this case. As stated in Lamkin v. Towner (1990), 138 Ill.2d 510, 522-23, 150 Ill.Dec. 562, 563 N.E.2d 449, "we must balance the foreseeability of the harm against the burdens and consequences that would result from recognition of a duty in these cases." In this case, if we were to recognize a duty on the part of CIPS to install utility poles so that they would fall "away from the road" when struck by an automobile, we would be placing an onerous and almost impossible burden on CIPS. First, given the variety of cars, trucks, vans, motorcycles, etc., the speed of these vehicles prior to impact, and the angle of impact, there are an infinite number of accident scenarios. Thus, it is possible that an automobile which leaves the traveled portion of a roadway might end up on the side of the pole away from the roadway. Second, in this case, there is a private country road south of Janette Street. If the utility pole in question had fallen away from the roadway (Janette Street), the utility pole would have fallen onto this private road. Lastly, CIPS argues, and we agree, that if a duty were placed on CIPS to ensure that its utility poles fall "away from the roadway," the economic costs would be staggering. According to CIPS, it owns and maintains hundreds of thousands of utility poles in central and southern Illinois. The amicus curiae briefs filed in this case indicate that the other utility companies throughout the State own and maintain millions of utility poles in Illinois. Provided technology permits the modification of utility poles such that when they are struck by an automobile they fall "away from the roadway," the cost to renovate these utility poles would be quite burdensome to the utility companies, and would ultimately be passed on to the citizens of Illinois.
For the above mentioned reasons, we reverse the appellate court, and affirm the circuit court.
Appellate court reversed; circuit court affirmed.
CUNNINGHAM, J., took no part in the consideration or decision of this case.
