
128 Cal.App.3d 297 (1982)
180 Cal. Rptr. 244
INSURANCE COMPANY OF NORTH AMERICA, Plaintiff and Appellant,
v.
LIBERTY MUTUAL INSURANCE COMPANY, Defendant and Respondent.
Docket No. 20601.
Court of Appeals of California, Third District.
January 29, 1982.
*299 COUNSEL
Dennis C. Noonan and J. Chauncey Hayes for Plaintiff and Appellant.
Hardy, Erich & Brown and William A. Wilson for Defendant and Respondent.
OPINION
PUGLIA, P.J.
Plaintiff, Insurance Company of North America (INA), appeals from a judgment of dismissal entered after the trial court sustained without leave to amend the demurrer of defendant (Liberty Mutual Insurance Company (Liberty)). This action was brought by INA for declaratory relief. The trial court found a judgment entered in an earlier action between INA and Her Majesty Industries (HMI), a party insured by Liberty, determined the issues involved in this case, and sustained the demurrer on grounds of res judicata and collateral estoppel. We reverse.
A detailed recital of the facts is required. The former action between HMI and INA followed settlement of a personal injury action arising out of an incident in which a child was severely injured when her nightgown, manufactured by HMI of cloth supplied to it by Jaftex Corporation (Jaftex), burned. INA was the liability insurance carrier of Jaftex. During the personal injury action, HMI became aware of a "broad form vendors endorsement" to the INA-issued Jaftex policy and tendered its defense to INA as an additional insured under the endorsement. The tender was refused, and the action proceeded to settlement with Jaftex and HMI participating.
HMI then filed an action against INA for declaratory relief, seeking a declaration that it was entitled to a defense by INA under the vendors' indorsement contained in the INA-issued Jaftex policy and also indemnity for the amount of the settlement and attorney's fees and *300 costs incurred in the personal injury action. INA defended the action on the basis that the vendors' indorsement did not run to HMI. At the conclusion of the trial, the court issued a decision, finding: (1) the policy issued by INA to Jaftex as a named insured also covered HMI as an additional insured by virtue of the broad form vendors' indorsement; (2) as an additional named insured, HMI was entitled to a defense by INA; and (3) HMI is entitled to the benefits of the insurance policy. Findings of fact and conclusions of law were waived and on May 17, 1977, the court entered judgment in favor of HMI for $254,000 which comprised its participation in the settlement and its costs of defending the personal injury action.[1] INA appealed, again contending that HMI was not an intended insured under the vendors' indorsement clause; the judgment, however, was affirmed. (Her Majesty Industries v. The Insurance Co. of North America (Dec. 22, 1978) 3 Civ. 16936 [unpub. opn.].)
In August 1980, INA filed the instant action against Liberty for declaratory relief, seeking a declaration that INA is entitled to reimbursement from Liberty for amounts paid by INA to HMI in the former action. The gist of the present action is the existence of "other insurance" clauses in the policies issued by both INA and Liberty. Liberty's "other insurance" clause provides that when the insured has other insurance which applies to a loss on the same basis, then each policy shall contribute towards the payment of a loss equally up to its limit of liability. INA asserts that as a result of the $254,000 judgment in favor of HMI, INA's total liability exceeded the limits of its Jaftex policy. To the extent that both the INA-issued Jaftex policy and the Liberty-issued HMI policy contained an "other insurance" clause, INA asserts Liberty must reimburse INA for amounts paid which exceed INA's policy limits together with one-half of the cost of defending the original suit brought on behalf of the injured child.
Liberty demurred to the complaint on various grounds, including the statute of limitations, laches, unclean hands, failure by INA to file a compulsory cross-complaint in the HMI v. INA action, and res judicata and collateral estoppel. After hearing and argument on the demurrer, the trial court rejected all grounds urged except res judicata and collateral estoppel. In this regard, the best that can be said for the trial court's ruling is that it is ambiguous. The court first asserts INA had the clear opportunity in the former action to argue the issue of "other insurance," but chose not to do so in favor of arguing "no coverage" under *301 the vendors' indorsement clause. The court then found the "issue" was tried in the former action. Regardless of the basis for its decision, the trial court was in error.

I
There is no question but that the issue of "other insurance" was not raised in the former action. Nonetheless, Liberty asserts this issue should have been raised in the previous action, and that INA's failure in this regard prevents it from prevailing in the instant action for declaratory relief. Instead of relying solely on the defense of "no coverage" by way of the vendors' indorsement, Liberty contends INA should also have raised the issue of the "other insurance" clauses, thereby seeking to determine whether Liberty had a duty to contribute to the settlement in the personal injury action. Liberty cites Sutphin v. Speik (1940) 15 Cal.2d 195, 202 [99 P.2d 652, 101 P.2d 497], for the proposition that "[a] party cannot by negligence or design withhold issues and litigate them in consecutive actions." Thus, Liberty asserts the prior judgment is res judicata as to matters which were raised or which could have been raised. (See ibid.)
This analysis shoots wide of the mark. The issue regarding the "other insurance" clauses was not raised for the simple reason that Liberty was not a party to the previous action. Thus, the question whether Liberty owed a duty to contribute to the judgment if it exceeded the limits of the INA-issued Jaftex policy was irrelevant to the issues involved in the former action, i.e., (1) whether INA owed a duty to defend HMI under the broad form vendors' indorsement clause, and (2) whether HMI was entitled to indemnification as a result of INA's failure to defend. The former action was one strictly limited to the rights of HMI vis-a-vis INA. For Liberty to contend INA had an affirmative obligation to assert against HMI those claims which could only be asserted against Liberty is manifestly incorrect.
Liberty devotes much of its argument on appeal reciting pleadings related to the former action wherein INA asserted that action was not so much one between HMI and INA as it was between Liberty and INA.[2]*302 Moreover, in its brief on appeal, Liberty contends it brought the former action as subrogee in the name of HMI as subrogor.[3]
In vigorously asserting the prior action was really one between INA and Liberty and that INA had the affirmative obligation to raise all defenses it might have in that action, Liberty conspicuously ignores the following taken from HMI's reply brief in the former action: "Defendant [INA] argues that Liberty Mutual had a `primary' duty to defend, and therefore, defendant is excused.... Liberty Mutual is not a party to this action. Its policy is not before this Court. Defendant's misconduct in arguing a matter not in evidence or even an [sic] issue is an obvious act of extreme desperation. Defendant's Reply Brief wasted the first four pages ... of its brief on improper and irrelevant material." (Italics added.)
(1) On the record before us, it appears that all attempts made by INA to assert Liberty was the real party in interest in the former action were vehemently denied by HMI, which argued that neither Liberty nor its policy had any connection with the action then at hand. Liberty, which is represented by the same counsel that has represented HMI throughout these several actions and proceedings, is in no position to assert it was the real party in interest in the former action. The fact is Liberty was not a party to the prior action. And because it was not a party, INA was without obligation and, in the action as framed by HMI, without the ability to assert any claims it might have against Liberty based upon the other insurance issue or any other issue.
Because Liberty was not a party to the former action, any claim of res judicata or collateral estoppel must fail. The doctrine of res judicata gives certain conclusive effect to a former judgment in subsequent litigation between the same parties involving the same controversy. (4 Witkin, Cal. Procedure (2d ed. 1971) Judgment, § 147, p. 3292.) It cannot be seriously argued that the instant action for declaratory relief pertaining to the issue of "other insurance" is in any way similar to the previous action concerning coverage under the vendors' indorsement *303 and HMI's rights thereunder. Moreover, it is clear the issue of other insurance was neither litigated nor could it have been raised and litigated in the action between INA and HMI, thus disposing of any claim of collateral estoppel. (See Witkin, op. cit. supra, § 197, pp. 3335-3336.) The trial court erred in sustaining the demurrer upon either of these grounds.

II
Liberty argues that because the former action brought by HMI was for both declaratory relief and for damages, INA had a duty to file a compulsory cross-complaint on all related defenses in that action. (Cf. E.L. White, Inc. v. City of Huntington Beach (1978) 21 Cal.3d 497, 505, fn. 4 [146 Cal. Rptr. 614, 579 P.2d 505].) Again, Liberty misses the point. Because Liberty was not a party in that action, there was no requirement that a compulsory cross-complaint be filed in the former action as to any claim INA might have against Liberty. (See Code Civ. Proc., § 426.30.) Nor can it be claimed that Liberty was an indispensable party to the former action. The issue therein was whether INA owed a duty to defend HMI under the vendors' indorsement contained in the INA-issued Jaftex policy. This issue could be and was litigated without any detriment or prejudice to whatever rights INA might have against Liberty or vice versa. (See Code Civ. Proc., § 389, subd. (a).)
Undoubtedly INA could have filed a permissive cross-complaint against Liberty in the former action, thus bringing Liberty into that action as a party defendant. (Code Civ. Proc., § 428.10, subd. (b).) By taking this course, INA could have asserted any claims it might have against Liberty based on the respective policies issued by both companies. While such an approach might well have resulted in a more orderly and expeditious resolution of the controversy, INA's failure to file a permissive cross-complaint has no effect upon its present ability to pursue its rights against Liberty.[4]


*304 III
(2) Liberty asserts INA has no claim to equitable subrogation because the insured, HMI, has no rights as against Liberty. Generally speaking, subrogation may be defined as the substitution of one person in the place of another with reference to a lawful claim, demand or right possessed by the other person. (73 Am.Jur.2d, Subrogation, § 1, p. 598.) Liberty argues that as it fully performed its contract with its insured (HMI) paying the entire defense and settling on behalf of HMI, it has fully discharged its contractual liability to HMI; thus, as HMI has no unrealized rights as against Liberty, there is no right of action against Liberty to which INA may be subrogated. For numerous reasons, we disagree.
First, we do not agree with Liberty's claim that it fully performed under the terms of its contract. HMI's right to indemnification from Liberty was only provisionally redeemed, later to be retracted when Liberty, in the name of HMI, prevailed in the previous action against INA. Contrary to Liberty's assertion, it has not paid for the costs of defending HMI, nor has it contributed to the settlement reached in the personal injury action; instead, INA has paid the entire personal injury settlement ($170,000) on behalf of HMI, and has fully reimbursed Liberty for the costs Liberty incurred in defending that action ($84,000).
Second, the point missed by Liberty is that HMI's discovery of coverage under the INA-issued Jaftex policy and the subsequent tendering of HMI's defense to INA did not relieve Liberty of its obligation to contribute a proportionate share to any resulting judgment or settlement. This is true, regardless of whether INA had accepted the tender of defense. Liberty's policy with HMI requires Liberty to pay up to its policy limits any insurable damage caused by its insured, and to defend the insured in any such litigation; if there is other insurance which also covers HMI, Liberty's policy provides it will pay a pro rata portion of any settlement or judgment up to its policy limits, and also, obviously, to share in the costs of the defense. At this point, however, Liberty has been fully reimbursed for all sums it contributed to the settlement and advanced for the defense of HMI. Under its policy with Liberty HMI has an existing claim that Liberty pay its share of both the defense costs and the settlement, and it is this claim to which INA is subrogated.
Stripped to its essentials, Liberty's argument is that a carrier which has breached its contract by refusing a tender of defense should *305 be penalized by having to pay the entire judgment (or settlement) plus the costs incurred in defending the action, relieving the performing carriers of all obligations under their respective policies with the insured.[5] We have been cited to no authority nor have we found any which allows a performing carrier to be indemnified fully by the carrier which wrongfully refused a tender of defense. To the contrary, Continental Cas. Co. v. Zurich Ins. Co. (1961) 57 Cal.2d 27 [17 Cal. Rptr. 12, 366 P.2d 455], sets forth the rule that all carriers, both performing and nonperforming, are to contribute a proportionate share both to the judgment or settlement and to the costs the performing carrier incurred in defending the action. (Id., at pp. 35-38.)
In Continental, one Hiatt was sued under a respondeat superior theory and a judgment taken against him for $20,000. Continental Casualty Company (Continental) defended Hiatt in that action. Hiatt had demanded both Zurich Insurance Company (Zurich) and General Insurance Company (General)  two carriers who had issued policies to other parties, but which arguably covered Hiatt as an additional insured  to defend the action, but both refused. Continental and Hiatt then instituted an action for declaratory relief, wherein the trial court held Zurich was primarily liable to the $15,000 limit of its policy, and that Continental and General were excess carriers and liable for the balance of the judgment on a pro rata basis. (57 Cal.2d at p. 31.) In addition, the trial court held all three carriers should share on a pro rata basis the costs Continental incurred in defending the action. (Ibid.)
The California Supreme Court affirmed, holding: "[I]t is our view that all obligated carriers who have refused to defend should be required to share in costs of the insured's defense, whether such costs were originally paid by the insured himself or by fewer than all of the carriers." (Italics added; Continental Cas. Co., supra, 57 Cal.2d at p. 37.) Although Zurich had wrongfully refused Hiatt's tender of defense, *306 Zurich was not penalized by having to pay the entire judgment. Instead, Zurich was held liable only up to its policy limits. (57 Cal.2d at pp. 34-35) General had also wrongfully refused the tender of defense, but instead of penalizing General by imposing liability for the entire excess, as Liberty here urges be done to INA, the court held the performing carrier (Continental) and the nonperforming carrier (General) were liable for the excess on a pro rata basis. (Ibid.)
The holding of Continental has consistently been applied since its announcement. (E.g., Wint v. Fidelity & Casualty Co. (1973) 9 Cal.3d 257 [107 Cal. Rptr. 175, 507 P.2d 1383]; Aetna Cas. & Surety Co. v. Certain Underwriters (1976) 56 Cal. App.3d 791 [129 Cal. Rptr. 47]; Travelers Ins. Co. v. Industrial Indem. Co. (1971) 18 Cal. App.3d 628 [96 Cal. Rptr. 191]; see also Travelers Indem. Co. v. Reliance Ins. Co. (1974) 12 Cal.3d 133 [115 Cal. Rptr. 232, 524 P.2d 360]; Donahue Constr. Co. v. Transport Indem. Co. (1970) 7 Cal. App.3d 291 [86 Cal. Rptr. 632].)
Liberty's reliance on State Farm Mut. Auto. Ins. Co. v. Allstate Ins. Co. (1970) 9 Cal. App.3d 508 [88 Cal. Rptr. 246], is unavailing. Allstate was found in breach of contract for wrongfully refusing a tender of defense. Nonetheless, the question of Allstate's liability for the entire judgment (which exceeded Allstate's policy limit) only arose when rulings at both the trial and appellate court level exonerated other carriers from any duty of coverage. There was thus no other insurer to whom Allstate could look for contribution. Moreover, the appellate court did not hold Allstate liable as a matter of law for the entire judgment; instead, the matter was remanded to the trial court to determine whether Allstate's refusal to accept the tender of defense caused the judgment to exceed its policy limits. (Id., at pp. 526-531.)
Liberty points out that in none of the cases which allowed a sharing of costs between performing and nonperforming insurers was it the "wrongful" carrier which initiated the action for contribution. Liberty distinguishes the instant action, claiming INA's "unclean hands" in regard to its refusal to accept HMI's tender of defense should bar any action for equitable subrogation. To allow INA to prosecute this action, contends Liberty, would be to reward INA for its failure to defend.
As a general rule, the application of the doctrine of unclean hands is primarily a question of fact. (Fibreboard Paper Products Corp. v. East Bay Union of Machinists (1964) 227 Cal. App.2d 675, 726-727 [39 *307 Cal. Rptr. 64]; Boericke v. Weise (1945) 68 Cal. App.2d 407, 418 [156 P.2d 781].) The complaint and other matters before the trial court on demurrer do not establish as a matter of law that INA's conduct was so tainted with inequitableness or bad faith as to bar relief. (See generally 7 Witkin, Summary of Cal. Law (8th ed. 1974) Equity, §§ 8-13, pp. 5233-5239.) In fact, when INA refused HMI's tender of defense, the effect and application of the broad form vendors' indorsement in its Jaftex policy were both uncertain and unsettled in the insurance industry. Perhaps for this reason Liberty has represented on this appeal that INA's conduct was "unencumbered by `bad faith'."
A "good faith" but unfounded refusal to defend will not insulate an insurer from liability for all harm suffered by an insured as a result of the carrier's breach of contract. There are compelling reasons for such policy. In every insurance contract there is an implied covenant of good faith and fair dealing between the insurer and its insured. (Comunale v. Traders & General Ins. Co., supra, 50 Cal.2d at p. 658.) Moreover, the insured cannot always bargain at arm's length with an insurer, and, in most instances, the insured must accept a contract written and prepared by the insurer. Thus, when a claim is made which arguably is within the scope of the policy, the insured has a right to expect a defense by his insurer and that the insurer will expend every effort in the insured's behalf in attempting to resolve the controversy. (See Gray v. Zurich, supra, 65 Cal.2d at p. 278.) When the insurer breaches this "covenant of good faith," it is fair to require the insurer to pay for all harm caused by the breach.
The policy considerations differ, however, when the issue concerns the rights of one insurer vis-a-vis a coinsurer. Liberty entered into no contract with INA, and Liberty at no time had any right to expect INA to assume the entire responsibility of defending an insured of which Liberty was a primary liability insurer. Moreover, Liberty makes no claim that the wrongful refusal to accept the tender of defense in any way enhanced HMI's liability or exposure to liability. (See Donahue Const. Co. v. Transport Indem. Co., supra, 7 Cal. App.3d at p. 304.) Nor does Liberty make any claim that the actions of INA caused any harm to Liberty; indeed, because of INA's refusal to accept the tender of defense, Liberty maintained exclusive control over HMI's defense and the settlement negotiations on HMI's behalf; Liberty also has been reimbursed for all sums expended on behalf of HMI. "As a general rule, the doctrine of unclean hands is applicable only when the party seeking to invoke it was injured by the alleged wrongful conduct *308 .... A fortiori, where the defendant has profited by the wrongful conduct, he is in no position to invoke the maxim." (Fns. omitted; 27 Am.Jur.2d, Equity, § 144, p. 681.) The order overruling Liberty's demurrer for unclean hands was not in error.
Finally, Liberty complains of the "rather bizarre nature of INA's present action." It was Liberty, however, which elected to pursue, in the name of HMI only, its claim for reimbursement from INA stemming from the settlement of the personal injury action. Had Liberty sued in its own name, questions of "other insurance," "contribution," and such other issues as are now consuming judicial time and expense would have been fully resolved. Indeed, in that posture the action would have been similar to Continental Cas. Co. v. Zurich Ins. Co., supra, wherein the performing carrier and its insured brought an action for contribution from the nonperforming carriers. As it was Liberty's decision to prosecute the previous action in the name of its insured only, Liberty now has no cause for complaint.
The judgment is reversed and the cause is remanded with instructions to the trial court to overrule Liberty's demurrer to the complaint.
Blease, J., and Sparks, J., concurred.
Respondent's petition for a hearing by the Supreme Court was denied May 12, 1982. Mosk, J., and Kaus, J., were of the opinion that the petition should be granted.
NOTES
[1]  The judgment was for a total of $254,000. Of this amount, $170,000 represented the amount of the settlement paid by HMI in the personal injury action. The remaining $84,000 represented attorney's fees and costs incurred by HMI in defending the personal injury action.
[2]  For example, Liberty points to the following which was taken from INA's trial brief in the former action: "The plaintiff in this instance is not Her Majesty Industries. This case in fact is, for all practical purposes, a subrogation lawsuit wherein the real party in interest, Liberty Mutual Insurance Company, is seeking to recover back from the Insurance Company of North America, the monies that it has paid out under its own policy of insurance." (Italics in original.)
[3]  E.g., "There appears to be no dispute that LIBERTY was the real party in interest to the former action as the equitable and contractual subrogee. As such for purposes of the doctrines of res judicata and collateral estoppel, LIBERTY was the party." (Italics in original.) Also, "[T]he [former action] was `for all practical purposes' Liberty v. INA...." (Italics in original.)
[4]  Code of Civil Procedure section 428.10 provides in pertinent part: "A party against whom a cause of action has been asserted in a complaint or cross-complaint may file a cross-complaint setting forth either or both of the following: ... (b) Any cause of action he has against a person alleged to be liable thereon, whether or not such person is already a party to the action, if the cause of action asserted in his cross-complaint (1) arises out of the same transaction, occurrence, or series of transactions or occurrences as the cause brought against him or (2) asserts a claim, right, or interest in the property or controversy which is the subject of the cause brought against him." (Italics added.)
[5]  Notwithstanding what may have been INA's good faith belief that HMI was not an additional insured under the INA-issued Jaftex policy, INA's refusal to accept the tender of defense renders it liable for breach of contract. (See Comunale v. Traders & General Ins. Co. (1958) 50 Cal.2d 654, 660 [328 P.2d 198].) Obviously, the wisest course of action would have been for INA to accept the tender of defense subject to a reservation of rights. (See Gray v. Zurich Insurance Co. (1966) 65 Cal.2d 263, 279 [54 Cal. Rptr. 104, 419 P.2d 168].) Having failed to do so, however, the issue presently at hand is whether INA's wrongful failure to accept the tender of defense means it has to absorb the entire bill in regard to HMI's settlement of the personal injury action, or whether HMI's other primary liability insurer, Liberty, which accepted HMI's tender of defense, is required to participate in payment of that settlement.
