
192 Cal.App.3d 951 (1987)
237 Cal. Rptr. 738
JANICE C. HUGHES, as Executrix, etc., Plaintiff and Appellant,
v.
WESTERN MacARTHUR COMPANY, Defendant and Respondent.
Docket No. A026434.
Court of Appeals of California, First District, Division Four.
June 16, 1987.
*953 COUNSEL
Hoberg, Finger, Brown, Cox & Molligan and James Geagan for Plaintiff and Appellant.
Hardin, Cook, Loper, Engel & Bergez, Eugene Brown, Jr., and Amber Lee Kelly for Defendant and Respondent.
[Opinion certified for partial publication.[*]]
OPINION
CHANNELL, J.
Appellant Janice C. Hughes, the surviving spouse of an asbestosis victim, filed a wrongful death action against several defendants, including respondent Western MacArthur Company. Following dismissal of the action against Western MacArthur, Hughes appeals, contending that the trial court (1) erred by requiring that she specifically plead that Western MacArthur was the successor in interest to Western Asbestos Company; (2) erred by requiring her to plead that the dual capacity doctrine applies; and (3) abused its discretion when denying her motion to amend her complaint to specifically plead these facts. We reverse the judgment.

I. FACTS
From 1944 to 1977, the husband of appellant Janice C. Hughes was employed as an asbestos worker; from 1944 until 1967, he worked for *954 Western Asbestos Company.[1] Late in 1977, he became unable to work as a result of asbestosis and malignant mesothelioma; the following year, he died from it. By that time, Western Asbestos Company had gone out of business.
In December 1978, Hughes filed a wrongful death action against several defendants, including Western Asbestos Company and respondent Western MacArthur Company. The complaint did not allege that Western MacArthur was the successor corporation of Western Asbestos Company; that Hughes's former spouse was an employee of either company; or that Hughes sued either of the corporations under the dual capacity doctrine, an exception to the workers' compensation exclusive remedy rule. (See former Lab. Code, § 3601.)[2] Instead, Hughes sued all defendants as asbestos manufacturers. Hughes's first amended complaint, filed in 1980, was substantially similar to the original complaint, except that it alleged additional theories of recovery for personal injury and fraud, as well as for wrongful death. Western MacArthur's answer alleged that Hughes's action was barred by section 3601 et seq. Although Hughes did not file another amended complaint, she did conduct discovery and obtained statements indicating that Western Asbestos Company was taken over by Western MacArthur in 1967.
Trial was scheduled to begin in November 1983, almost five years after Hughes filed her action. On the day trial was to begin, Western MacArthur made two motions in limine, asking the trial court to prevent Hughes from attempting to prove either that it was the successor in interest to Western Asbestos Company or that the dual capacity doctrine applied. The trial court granted the motions and denied Hughes's motion to amend her complaint to plead these facts. After Hughes waived her right to recover, she conceded that the court's rulings left her without a basis on which to pursue the litigation against Western MacArthur. Western MacArthur then moved for judgment on the pleadings. The trial court granted the motion and filed an amended judgment in favor of Western MacArthur on February 2, 1984. Hughes filed a timely appeal from the amended judgment.[3]

II. STANDARD OF REVIEW
(1) The standard of review for a judgment on the pleadings is the same as for a judgment following sustaining of a demurrer; we look only to the *955 face of the pleading under attack. (Fosgate v. Gonzales (1980) 107 Cal. App.3d 951, 957 [166 Cal. Rptr. 233]; Tiffany v. Sierra Sands Unified School Dist. (1980) 103 Cal. App.3d 218, 225 [162 Cal. Rptr. 669]; Baillargeon v. Department of Water & Power (1977) 69 Cal. App.3d 670, 675-676 [138 Cal. Rptr. 338].) The complaint cannot be attacked by reference to matters set forth in the answer. (Fosgate v. Gonzales, supra, 107 Cal. App.3d at p. 957; Baillargeon v. Department of Water & Power, supra, 69 Cal. App.3d at p. 676; Schwartz v. Schwartz (1946) 74 Cal. App.2d 711, 713 [169 P.2d 688] [answer alleged affirmative defense]; Elmore v. Tingley (1926) 78 Cal. App. 460, 464-465 [248 P. 706].) All facts alleged in the complaint are admitted for purposes of the motion and the court determines whether these facts constitute a cause of action. (Tiffany v. Sierra Sands Unified School Dist., supra, 103 Cal. App.3d at p. 225; Schwartz v. Schwartz, supra, 74 Cal. App.2d at p. 713; Elmore v. Tingley, supra, 78 Cal. App. at p. 465.) The court may also consider matters subject to judicial notice. (Baillargeon v. Department of Water & Power, supra, 69 Cal. App.3d at p. 676; see 6 Witkin, Cal. Procedure (3d ed. 1985) Proceedings Without Trial, § 263, pp. 564-565.) With this in mind, we turn to the merits of the appeal.

III. SUCCESSOR IN INTEREST

A. Mootness

(2) A successor corporation may, in some circumstances, be held liable for acts of its predecessor. (Ray v. Alad Corp. (1977) 19 Cal.3d 22, 34 [136 Cal. Rptr. 574, 560 P.2d 3].) (3a) In Kaminski v. Western MacArthur Co. [(1985) 175 Cal. App.3d 445 (220 Cal. Rptr. 895)], an appellate court ruled that Western MacArthur is, as a matter of law, the corporate successor in interest to the now-defunct Western Asbestos Company. (Id., at pp. 453-459.) Hughes argues that this ruling makes any failure to plead successorship moot. This argument deflects attention from the dispositive issue  whether Hughes must plead the successor relationship, not whether such a relationship could be proven. The trial court did not rule that Western MacArthur is not actually the successor in interest of Western Asbestos Company; it ruled that this relationship must be pleaded by Hughes. Kaminski does not address the issue in the case before us.[4]

B. Actual Notice

Hughes also contends that because Western MacArthur learned that she intended to hold it liable as the successor corporation to Western Asbestos *956 Company as a result of her discovery, there was no need for the formal notice of a pleading allegation. Again, while Western MacArthur may have thus understood Hughes's intent, this contention begs the question of whether Hughes was bound to put the company on formal notice of her intent in her complaint.

C. Pleading Requirement

On the merits, Hughes contends that the trial court erred by requiring that she specifically plead that Western MacArthur was the successor in interest to Western Asbestos Company. (4) A civil complaint serves to frame and limit the issues and to apprise the defendant of the basis on which the plaintiff seeks recovery. (Committee on Children's Television, Inc. v. General Foods Corp. (1983) 35 Cal.3d 197, 211-212 [197 Cal. Rptr. 783, 673 P.2d 670].) The complaint also limits the proof that may be submitted, because it advises the court and the adverse party of what plaintiff relies on as a cause of action. (Roth v. Cottrell (1952) 112 Cal. App.2d 621, 624 [246 P.2d 958]; see Committee on Children's Television, Inc. v. General Foods Corp., supra, 35 Cal.3d at pp. 211-212.)
(3b) Hughes's complaint did not allege an essential factor in this case  that she intended to hold Western MacArthur liable for acts committed by its predecessor corporation, Western Asbestos Company. Although we must construe pleadings liberally (Simons v. County of Kern (1965) 234 Cal. App.2d 362, 367 [44 Cal. Rptr. 338]), this presumption does not relieve Hughes of the obligation to plead some allegation from which we may construe a legal connection between the party that injured her and the party whom she seeks to hold liable for her injury. In a complaint, the plaintiff must allege every fact that he or she must prove. (Gunderson v. Gunderson (1935) 4 Cal. App.2d 257, 260 [40 P.2d 956].) At the hearing on the motion for judgment on the pleadings, even Hughes's counsel acknowledged that without the ability to present evidence of successor liability, she could not hope to prevail. The trial court did not err in finding the complaint deficient.

IV. DUAL CAPACITY DOCTRINE
(5a) Next, Hughes claims that the trial court erred by requiring that she specifically plead the application of the dual capacity doctrine.
Before 1982,[5] when an employer engaged in a relationship with an employee that was distinct from the ordinary employer-employee relationship, *957 invoking a different set of obligations from the employer's typical duties to its employees, the employee could recover damages for breach of the employer's special obligations under the dual capacity doctrine, even though the workers' compensation exclusive remedy rule (former § 3601)[6] barred recovery for work-related injuries. (Cole v. Fair Oaks Fire Protection Dist. (1987) 43 Cal.3d 148, 161; D'Angona v. County of Los Angeles (1980) 27 Cal.3d 661, 667.) The "dual capacity" doctrine was premised on the principle that one may have separate and distinct legal personalities  that an individual may act in two or more different, distinct capacities, either simultaneously or sequentially, giving rise to separate and distinct obligations. (Perry v. Heavenly Valley (1985) 163 Cal. App.3d 495, 505.)
(6) When a complaint affirmatively alleges facts indicating coverage by workers' compensation laws but fails to state additional facts negating the application of the exclusive remedy rule, no civil action will lie and the complaint is subject to a general demurrer. (Roberts v. Pup `N' Taco Driveup (1984) 160 Cal. App.3d 278, 284 [206 Cal. Rptr. 533]; Coleman v. Silverberg Plumbing Co. (1968) 263 Cal. App.2d 74, 79 [69 Cal. Rptr. 158]; see Singleton v. Bonnesen (1955) 131 Cal. App.2d 327, 330-331 [280 P.2d 481] [dual capacity must be pleaded if complaint allows inference that plaintiff was employee].) This pleading requirement is jurisdictionally based; if the complaint indicates that the action is within the scope of the workers' compensation law, the superior court has no jurisdiction over it unless additional allegations indicate that an exception to the exclusive remedy rule applies. (See Deauville v. Hall (1961) 188 Cal. App.2d 535, 540 [10 Cal. Rptr. 511], cert. den. 368 U.S. 824 [7 L.Ed.2d 28, 82 S.Ct. 43].)
(5b) Hughes did not allege an employment relationship in her complaint. The relationship between Hughes's former spouse and Western Asbestos Company was not before the trial court, except insofar as the affirmative defense in Western MacArthur's answer allows this inference. However, on a motion for judgment on the pleadings, the complaint cannot be attacked by reference to matters set forth in the answer. (Fosgate v. Gonzales, supra, 107 Cal. App.3d at p. 957; Schwartz v. Schwartz, supra, 74 Cal. App.2d at p. 713 [answer alleged affirmative defense]; Elmore v. Tingley, supra, 78 Cal. App. at pp 464-465; see 6 Witkin Cal. Procedure, supra, Proceedings Without Trial, § 263, p. 565.) Viewing the complaint in isolation, *958 we must determine whether it states a cause of action. (Tiffany v. Sierra Sands Unified School Dist., supra, 103 Cal. App.3d at p. 225; see 6 Witkin, Cal. Procedure, supra, Proceedings Without Trial, § 263, p. 565.) Western MacArthur concedes that, until its answer suggested the existence of an employer-employee relationship, Hughes was not obligated to plead the application of the dual capacity exception, and we agree. The trial court erred in finding that Hughes was required to plead the dual capacity doctrine in her complaint. The judgment on the pleadings must be reversed on this ground.

V. MOTION TO AMEND COMPLAINT[*]
.... .... .... .... .... .
The judgment is reversed. Each party to bear its own costs.
Anderson, P.J., and Sabraw, J., concurred.
Appellant's petition for review by the Supreme Court was denied September 23, 1987.
NOTES
[*]   Pursuant to California Rules of Court, rules 976(b) and 978.1, this opinion is certified for publication with the exception of part V.
[1]  For two months, Hughes's husband appears to have worked for Western MacArthur. However, Hughes waived her right to recover against Western MacArthur for the period during which her husband may have worked for that company.
[2]  All statutory references are to the Labor Code, unless otherwise indicated.
[3]  As Hughes appeals from "the Amended Judgment ... in favor of WESTERN MACARTHUR COMPANY," we need not consider Western MacArthur's contention that an order denying a motion to amend the complaint is not appealable. (See 9 Witkin, Cal. Procedure (3d ed. 1985) Appeal, § 41, pp. 64-65 [nonappealable order may be reviewed on appeal from subsequent judgment].)
[4]  As such, we need not address the question of whether Kaminski applies retroactively.
[5]  Effective 1983, sections 3601 and 3602 were amended to restrict the application of the dual capacity doctrine. (Stats. 1982, ch. 922, §§ 5-6, pp. 3366-3367; Fireman's Fund Ins. Co. v. Fibreboard Corp. (1986) 182 Cal. App.3d 462, 469 [227 Cal. Rptr. 203].) However, as the date of injury was before the amendments took effect, we must apply the former law. (Cole v. Fair Oaks Fire Protection Dist. (1987) 43 Cal.3d 148, 153 [233 Cal. Rptr. 308, 729 P.2d 743]; Young v. Libbey-Owens Ford Co. (1985) 168 Cal. App.3d 1037, 1040, fn. 3 [214 Cal. Rptr. 400].)
[6]  Subdivision (a) of former section 3601 provided that "... the right to recover [workers'] compensation ... is ... the exclusive remedy for injury or death of an employee against the employer...." (Stats. 1971, ch. 1751, § 1, p. 3780.)
[*]   See footnote page 951, ante.
