*502 Opinion
Plaintiff E. L. White, Inc. (White) and its insurance carrier appeal from a judgment of dismissal entered following an order sustaining, without leave to amend, the demurrer of defendant City of Huntington Beach (City) to its first amended complaint in an action for “indemnity and equitable contribution.” We reverse the judgment.
The complaint here at issue, together with certain documents attached to City’s demurrer of which the trial court properly took judicial notice (see Code Civ. Proc., §§ 430.30, 430.70), discloses the following pertinent facts: In 1970 City entered into a contract with White for the construction of certain public improvements which included a deep storm drain. The contract contained a provision requiring that White “indemnify and save harmless [City] from any suits, claims, or actions brought by any person or persons for or on account of any injuries or damages sustained because of or arising out of the performance of the work contemplated or in consequence thereof.” The contract also provided that White was to provide public liability insurance, naming City as insured, with bodily injury limits of not less than $250,000 for each person and $500,000 for each accident.
White subcontracted with the firm of Barnett and Thomas (B & T) for the storm drain portion of the work, which apparently required the cutting of a sewer line to allow the installation of the storm drain which passed beneath and at right angles to the sewer line. The work was completed and the necessary excavation filled, but some five months later the sewer system began to malfunction in the area where the sewer line had been cut to allow for installation of the storm drain. City, which had previously accepted the work as completed, contacted White and B & T and arranged to have the latter make repairs, the understanding being that if the malfunction were found to be the result of faulty work previously done by B & T the repairs would be at no cost to City.
In order to reach the sewer line it was necessary that a 14-foot trench be dug. This was done, but apparently the walls of the trench were neither shored nor sloped in compliance with applicable California construction safety orders. Nevertheless two B & T employees, Ellett and Butcher, descended into the trench to perform the necessary inspection and work. While they were so engaged City’s chief construction inspector and its chief construction engineer visited the site several times, and although they noticed the indicated safety order violation they took no *503 action to compel compliance before the work continued. Later the same day, while Ellett and Butcher were continuing their work in the trench, one of its walls collapsed upon them. Ellett was killed, and Butcher was injured.
It was later found that the malfunctioning of the sewer line had been the result of faulty work by B & T in its installation of the storm drain.
Separate actions by Butcher and by Ellett’s heirs were consolidated for trial and resulted in verdicts of $9,500 and $240,000 respectively against City and White. The judgments on those verdicts were affirmed on appeal, and a hearing was denied by this court.
Before the foregoing actions went to trial City and its liability carrier had filed a separate action against White and its liability carrier, B & T, and others, seeking, as here relevant (1) a declaration of the rights, duties, and obligations of the parties as the same pertained to the insurance policies issued in favor of City by White’s carrier pursuant to the 1970 contract, (2) a judgment requiring the said carrier “to provide, by way of insurance coverage, a defense for, indemnity of, and to hold harmless [City] on the basis that said insurance coverage is primary, or alternatively, is pro-rata insurance,” (3) a judgment that City and its carrier be reimbursed for expenses incurred, (4) a declaration that none of the parties defendant was entitled to recover for any payments made for death benefits, medical expenses and/or unemployment disability benefits, (5) a judgment in favor of City and its carrier for breach of contract, and (6) costs of suit and other appropriate relief. White and its carrier answered the complaint with a general denial (see Code Civ. Proc., § 431.30) and asserted as an affirmative defense that the complaint failed to state a cause of action. The action proceeded to trial and a judgment resulted in favor of White and its carrier, the trial court finding that City had been actively negligent and concluding that therefore indemnity under the general indemnity clause of the construction contract was precluded. (See
Rossmoor Sanitation, Inc.
v.
Pylon, Inc.
(1975)
The instant action was filed in 1975, after judgment in the aforesaid action but prior to the determination of the appeal. Here the parties are reversed. White and its carrier seeking a judgment for “indemnity and equitable contribution” against City for sums paid by them in satisfaction of the Ellett and Butcher judgments or, alternatively, for “damages ... to *504 compensate plaintiffs for that portion of the damages suffered by the Elletts and Butcher and paid by plaintiffs that was caused by defendant’s active negligence.” City’s demurrer, as here relevant, advanced two essential grounds. These were (1) that plaintiffs’ action was barred in its entirety by reason of the provisions of Code of Civil Procedure section 426.30, dealing with compulsory cross-complaints, and (2) that no cause of action was stated. 1 Attached to the demurrer, as indicated above, were a number of exhibits, of which the trial court was requested to take judicial notice. These included the pleadings in the Ellett and Butcher actions, the complaint and answer in City’s action against White, the contract between White and City, and the bidding documents relating thereto. After hearing argument on the matter,, the trial court entered an order indicating that it had taken judicial notice of the requested matters and sustained City’s demurrer without leave to amend. White and its carrier appeal from the ensuing judgment of dismissal.
A judgment of dismissal entered after the trial court has sustained a demurrer without leave to amend
2
will be affirmed on appeal if any of the grounds stated in the demurrer is well taken. (See
Stowe
v.
Fritzie Hotels, Inc.
(1955)
*505 As indicated above, the first ground of defendant’s demurrer was that the instant action was barred by reason of the rule of compulsory cross-complaints set forth in section 426.30 of the Code of Civil Procedure. As here relevant that section provides: “Except as otherwise provided by statute, if a party against whom a complaint has been filed and served fails to allege in a cross-complaint any related cause of action which (at the time of serving his answer to the complaint) he has against the plaintiff, such party may not thereafter in any other action assert against the plaintiff the related cause of action not pleaded.”
White and its carrier contend that the bar of section 426.30 is here inapplicable—both by its own terms and by specific statutory exemption. In the first place, they urge their causes of action against City did not arise until July 30, 1975, more than two years after the filing of their answer to City’s complaint, when they made payment to Butcher and the Ellett heirs following affirmance of the casualty judgment on appeal. 3 Thus, they reason, the causes of action they now seek to assert, even if “related” to any of those stated in City’s prior action, were not causes “which (at the time of serving [their] answer to the complaint) [they had] against the plaintiff.” Moreover, they point out, the provisions of section 426.60, subdivision (c) of the Code of Civil Procedure expressly exempt from the operation of the compulsory cross-complaint rule actions in which “the only relief sought is a declaration of the rights and duties of the respective parties in an action for declaratory relief ....” City’s prior action, they urge, was essentially of the indicated character.
While we are not without doubts concerning the latter of these contentions,
4
we think it clear that the former has merit. The Senate Committee on Judiciary, in remarks designed to express its intent in approving section 426.30 for passage, explicitly stated: “Only related causes of action that exist at the time of service of the answer to the complaint on the particular plaintiff are affected by Section 426.30.”
*506
(Rep. of Sen. Committee on Judiciary on Sen. Bill No. 201, 1 Sen.J. (1971 Reg. Sess.) p. 885.) It is well settled that a cause of action for implied indemnity does not accrue or come into existence until the indemnitee has suffered actual loss through payment.
(Sunset-Sternau Food Co.
v.
Bonzi
(1964)
We are thus brought to the second major ground of City’s demurrer. Simply stated, this ground was that the complaint failed to state a cause of action because the contract of the parties—providing that White would indemnify and save City harmless from “any suits, claims, or actions brought by any person or persons for or on account of any injuries or damages sustained” because of or arising out of the work —effectively operated to preclude any claim for implied indemnity or “equitable contribution” in favor of White and its carrier against City. In short it is argued that the parties, by agreeing to the quoted indemnification provision, thereby memorialized the entire agreement between them regarding indemnity inter se, and by excluding from their agreement any language indicating a right of indemnity in White against City, they indicated their intention that no such right should exist or be implied under any circumstances in favor of White.
This contention finds no support in our law. The obligation of indemnity, which we have defined as “the obligation resting on one party to make good a loss or damage another has incurred”
(Rossmoor Sanitation, Inc.
v.
Pylon, Inc., supra,
Each of these two basic forms of indemnity is subject to its own distinctive legal rules and limitations. Those governing so-called “express” indemnity reflect its contractual nature, permitting great freedom of action to the parties in the establishment of the indemnity arrangements while at the same time subjecting the resulting contractual language to established rules of construction.
5
Thus, whereas the parties to an express indemnity provision may, by the use of sufficiently specific language, establish a duty in the indemnitor to save the indemnitee harmless from the results of even active
6
negligence on the part of the latter (see
Goldman
v.
Ecco-Phoenix Elec. Corp.
(1964)
Within the limitations of the language used, however, an express indemnity clause is accorded a certain preemptive effect, displacing any
*508
implied rights which might otherwise arise within the scope of its operation. Thus, as we stated in
Markley
v.
Beagle
(1967)
The case of
People
ex rel.
Dept. Pub. Wks.
v.
Daly City Scavenger Co.
(1971)
The recent case of
Hollywood Turf Club
v.
Montgomery Elevator Co., supra,
While we find the opinion in
Hollywood Turf Club
to be somewhat opaque in the above respect, we think it reaches a result which is consistent with the principles reviewed above, which we now proceed to apply to the instant case. It has been finally determined in the prior declaratory relief action brought by City against White that the contractual provision herein involved was not intended to and did not create an obligation in the contractual indemnitor White to hold the contractual indemnitee City harmless from liability resulting in whole or in part from the latter’s active negligence. It has also been determined in that action that City was actively negligent, and that its negligence was a cause of the damage underlying liability. (See paragraph next preceding fn. 1,
ante.)
These two determinations, which City is collaterally estopped from now disputing, necessarily lead to the conclusion that the scope of the express indemnity clause agreed to by the parties did not extend to the circumstances which subsequently arose and led to liability. This being so, any preemptive effect (see paragraph following fn. 7, ante) which the clause might have had in circumstances not involving active negligence on City’s part did not extend to the instant situation. Accordingly, the principles of implied equitable indemnity must be held to have come into play. The specific application of those principles to the facts herein is a matter to be determined at trial in accordance with the evidence presented to the court. This determination, we hold, is to be conducted in light of the teaching set forth in our recent decision in
American Motorcycle Assn.
v.
Superior Court
(1978)
In closing we briefly dispose of/a contention raised for the first time by amicus curiae California Department of Transportation in its brief filed by permission before this court. Although it is the general rule that an amicus curiae accepts the case as he finds it and may not “launch
*511
out upon a juridical expedition of its own unrelated to the actual appellate record”
(Pratt
v.
Coast Trucking Inc.
(1964)
The judgment is reversed.
Bird, C. J., Tobriner, J., Mosk, J., Clark, J., Richardson, J., and Newman, J., concurred.
Notes
The demurrer also asserted the ground of uncertainty. In view of the fact that the complaint here in question was the first to be attacked by demurrer, we think it apparent that the order sustaining the demurrer without leave to amend was not based upon this ground. In any event, when a demurrer interposed on both general and special grounds is sustained without leave to amend in general terms and without a specification of reasons (see Code Civ. Proc., § 472d), it will be assumed on appeal that the court ruled only in the general demurrer and not on the special demurrer.
(Briscoe
v.
Reader's Digest Association, Inc.
(1971)
The court’s failure to specify the grounds on which its order sustaining the demurrer was based constituted error. (See Code Civ. Proc., § 472d;
Mack
v.
Hugh W. Comstock Associates
(1964)
Trial of the Ellett and Butcher actions was concluded March 12, 1975. The judgment was affirmed May 19, 1975, and the remittitur was filed July 23, 1975.
As indicated above, section 426.60, subdivision (c), is applicable to exempt a cause of action from compulsory joinder requirement when the “only” relief sought is declaratory. As stated in the legislative committee comment concerning the subdivision, “[i]f any party to an action seeks a remedy other than declaratory relief, the compulsory joinder provisions apply.” (Rep. of Sen. Committee on Judiciary on Sen. Bill No. 201, 1 Sen.J. (1971 Reg.Sess.) p. 887.) Although City’s complaint sounded largely in declaratory relief, we note that it also sought damages for breach of contract, presumably on the basis that White and its carrier had failed to provide it a defense to the Ellett-Butcher action. In these circumstances we think it questionable whether City’s action could be accurately termed one seeking only declaratory relief.
See generally
Price
v.
Shell Oil Co.
(1970)
The parties’ contractual freedom in this area is subject to certain limitations of public policy. (See Civ. Code, §§ 1668, 2773, 2782, 2784.5.)
In the
Davidson
case, which has been the subject of extensive discussion by the parties hereto, the owner of certain garage premises leased them to an automobile dealership, which in turn agreed to employ him to operate the body shop therein. The lease agreement provided that it was made “upon the express condition that Lessor is to be free from all liability claimed for damage by reason of any injury to any person or persons, including Lessee, from any cause or causes while in or upon the demised premises . . . .” The lessee-employer also expressly agreed to indemnify and save the lessor-employee harmless “for all liability, loss, costs, or obligations on account of or arising out of any injury or losses however occurring.” (
We do not read the Davidson case as broadly as City would have us. As appears from the above review, the Court of Appeal there held simply that the language of the express agreement there in question was to be interpreted to cover even the extreme circumstances before the court, and that the principles of implied indemnity, which otherwise would have operated in favor of the lessee-employer, therefore had no place in the case. It clearly did not hold, as urged by City, that the mere presence of an express indemnity provision, whatever its scope and application to the factual context before the court, operates to preclude recourse by either party to the principles of implied indemnity.
The provision also contained language construed to except from the scope of the clause liability for accidents “directly due” to the negligence of the elevator company. (
Section 815 of the Government Code provides that a public entity “is not liable for an injury, whether such injury arises out of an act or omission of the public entity or a public employee or any other person” unless such liability is provided for by statute.
Section 835 provides in full: “Except as provided by statute, a public entity is liable for injury caused by a dangerous condition of its property if the plaintiff establishes that the property was in a dangerous condition at the time of the injury, that the injury was proximately caused by the dangerous condition, that the dangerous condition created a reasonably foreseeable risk of the kind of injury which was incurred, and that either: (a) A negligent or wrongful act or omission of an employee of the public entity within the scope of his employment created the dangerous condition; or (b) The public entity had actual or constructive notice of the dangerous condition under Section 835.2 a sufficient time prior to the injury to have taken measures to protect against the dangerous condition.”
Section 810.8 provides: “ ‘Injury’ means death, injury to a person, damage to or loss of property, or any other injury that a person may suffer to his person, reputation, character, feelings or estate, of such nature that it would be actionable if inflicted by a private person.”
