
213 Cal.App.2d 252 (1963)
VEGETABLE OIL PRODUCTS COMPANY, INC., Petitioner,
v.
THE SUPERIOR COURT OF LOS ANGELES COUNTY, Respondent; ELMER L. FERREL, Real Party in Interest.
Civ. No. 26841. 
California Court of Appeals. Second Dist., Div. Three.  
Feb. 20, 1963.
 Schell & Delamer and Lee A. Solomon for Petitioner.
 Harold W. Kennedy, County Counsel, Donald K. Byrne and John J. Collins, Deputy County Counsels, for Respondent.
 Edgar Simon for Real Party in Interest.
 FILES, J.
 This case, like Tate v. Superior Court, ante, at page 238 [28 Cal.Rptr. 548], involves an attempt by a defendant in a personal injury action to base a defense and a cross-complaint upon the allegation that the plaintiff's employer negligently caused the injury.
 The facts, as alleged in the petition filed here, are admitted by the return. On June 9, 1958, Elmer L. Ferrel commenced an action in the respondent superior court to recover damages for bodily injuries. At the time of his injury, Ferrel was employed by Bay View Welding Works to make repairs on a large metal storage tank owned by Vegetable Oil Products Company, Inc. Ferrel's original complaint for damages named as defendants Safway Steel Scaffolds, Vegetable Oil Products Company, Inc., and Bay View Welding Works. A general demurrer interposed by Bay View was sustained on August 1, 1958, and Ferrel thereafter filed an amended complaint omitting that party. The action was tried and judgment entered for defendants. On appeal, the Supreme Court reversed and remanded for a new trial against the defendant Vegetable Oil only. (Ferrel v. Safway Steel Scaffolds, 57 Cal.2d 651 [21 Cal.Rptr. 575, 371 P.2d 311].) The evidence, as described in the Supreme Court's opinion, showed that the accident occurred while Ferrel was inside the tank standing on a scaffold attempting to straighten out a buckle in the side of the tank, using a hydraulic jack. When the jack was retracted the buckle sprang in again, throwing Ferrel to the ground. There was evidence that the method adopted by Bay View was not standard practice, and that attempting to repair the tank in this manner is unusually dangerous to workmen. The court held that Vegetable Oil could be held liable to the injured workman under the theory that it was aware of the danger created by Bay View's conduct but had failed to take precautions of its own to prevent the accident.
 [1] The remittitur was filed in the superior court on June 18, 1962. On July 6, 1962, Vegetable Oil filed a motion *255 for leave to amend its answer to allege an additional affirmative defense as follows: that at the time of Ferrel's injury he was acting in the course and scope of his employment as an employee of Bay View; that Bay View had procured workmen's compensation insurance with Casualty Insurance Company; that said compensation carrier had paid benefits to Ferrel and claims a lien on any recovery by Ferrel; that Ferrel's injury was caused by the negligence of Bay View, and that Bay View and its compensation carrier are therefore barred from recovery of anything.
 The motion further asked leave to file a cross-complaint and join Bay View and Casualty Insurance Company as cross-defendants.
 On October 3, 1962, the court made an order denying this motion in all respects. The order further provided that "If it should be determined in any appellate proceeding" that the cross-complaint be filed and the new parties joined, "then this Court under Code of Civil Procedure section 1048 orders all proceedings upon said cross-complaint be severed, for separate trial."
 Vegetable Oil then petitioned this court for a writ of mandamus to compel the granting of its motion.
 The opinion filed this day in Tate v. Superior Court, ante, at page 238 [28 Cal.Rptr. 548], explains the view of this court that petitioner is entitled to plead the contributory negligence of the employer and that mandamus should issue to enforce that right. The timeliness of petitioner's motion cannot be questioned, coming within three weeks after the remittitur. No showing of merits need be made beyond a reference to the opinion of the Supreme Court, which describes the evidence from which the negligence of the employer, Bay View, could be inferred.
 Respondent makes the additional argument here that the dismissal of Bay View after the demurrer was sustained to the original complaint constitutes an adjudication that Bay View was not at fault. The allegations of the original complaint have not been made a part of the record here, but nothing before this court now would indicate that there was any such adjudication. The most obvious probable reason for the dismissal of Bay View is that the complaint showed that Bay View was plaintiff's employer, and Labor Code, section 3601, bars any such action against the employer by an employee who is entitled to the benefits of the *256 compensation act. [2] A judgment in an action in which the parties were not adversaries, but only joined as codefendants, is not res judicata as between them. (Atherley v. MacDonald, Young & Nelson, 135 Cal.App.2d 383, 385 [287 P.2d 529].) There is nothing before this court to indicate that any adverse claim as between Bay View and Vegetable Oil was raised before Bay View was dismissed as a defendant in 1958. The joinder and dismissal of Bay View in 1958 therefore is without consequence now.
 [3] The cross-complaint proposed by Vegetable Oil involves issues not raised in the Tate proceeding. It is in two separate causes of action. One is for declaratory relief against Bay View's compensation carrier, Casualty Insurance Company, asking a declaration that the carrier is not entitled to recover back any benefits paid to Ferrel, and that Ferrel's recovery, if any, against Vegetable Oil must be reduced by the amount of the compensation benefits. This is the type of cross-complaint which was held to be proper in City of Sacramento v. Superior Court, 205 Cal.App.2d 398 [23 Cal.Rptr. 43]. As indicated in the Tate opinion, such a cross-complaint is not necessary where the issue is properly raised by answer. At worst, this part of the cross- complaint is surplusage and is not ground for rejecting the entire pleading.
 [4] The other cause of action of the proposed cross-complaint is directed against Bay View. Therein Vegetable Oil, as cross-complainant, alleges that when it engaged Bay View to repair the storage tank, the latter agreed to perform the work in a careful and prudent manner; that Bay View had the exclusive control and supervision over the work; that Ferrel's accident was caused by Bay View's negligence; and that Bay View has an implied duty to indemnify Vegetable Oil against any claim for damage or expense resulting from Bay View's failure to provide for the safety of the workmen. The prayer is for a declaration that Bay View is obligated to pay any judgment, costs, attorney's fees and expenses incurred by Vegetable Oil in the action brought against it by Ferrel.
 The allegations state a cause of action for indemnification under the principles discussed in San Francisco Unified School Dist. v. California Bldg. etc. Co., 162 Cal.App.2d 434 [328 P.2d 785]; Montgomery Ward & Co. v. KPIX Westinghouse Broadcasting Co., 198 Cal.App.2d 759 [18 Cal.Rptr. *257 341], and Cahill Bros., Inc. v. Clementina Co., 208 Cal.App.2d 367 [25 Cal.Rptr. 301]. A cross-complaint for declaratory relief is an appropriate way of having this right to indemnity determined. (Roylance v. Doelger, 57 Cal.2d 255 [19 Cal.Rptr. 7, 368 P.2d 535].)
 [5] Although the cross-complainant's cause of action grows out of events which occurred and rights which were fixed on the date of the accident (June 11, 1957), the cross-complaint is not barred by any statute of limitations.
 De La Forest v. Yandle, 171 Cal.App.2d 59 [340 P.2d 52], was an action for indemnification brought by a party who had been required to pay damages because of a defective condition against the party who had created that condition. The appellate court there held that the action was not barred by the statute of limitations because the statute did not begin to run until the claim of the injured party against the indemnitee had been settled.
 If it were the law that the statute of limitations starts to run when the bodily injury occurs, the indemnitee's remedy would be most unsatisfactory. Until the amount of the damages was determined by a judgment or a compromise with the injured party, the indemnitor would have no way of either measuring or discharging his duty to his indemnitee. The only workable approach is that applied in the De La Forest case--that the period of limitations starts to run from payment.
 [6a] Effective September 18, 1959, the Legislature added to the chapter of the Labor Code on workmen's compensation "subrogation," a new section 3864 which reads:
 "If an action as provided in this chapter prosecuted by the employee, the employer, or both jointly against the third person results in judgment against such third person, or settlement by such third person, the employer shall have no liability to reimburse or hold such third person harmless on such judgment or settlement in absence of a written agreement so to do executed prior to the injury."
 The liability which Vegetable Oil seeks to establish by its cross- complaint appears to be the kind referred to in the 1959 statute. Although the proposed cross-complaint refers to a "written letter and order" which are "attached and made a part hereof," no such attachment is included in the papers brought before this court. The proposed cross-complaint alleges "an implied duty to indemnify," and *258 petitioner does not argue that its cross-complaint is based upon any written agreement to hold harmless. Rather, petitioner is contending that its rights accrued before section 3864 became effective, and hence cannot be cut off by the new legislation.
 American Can Co. v. City & County of San Francisco, 202 Cal.App.2d 520, 524 [21 Cal.Rptr. 33], held that section 3864 could not be applied to an action growing out of an injury which occurred on September 17, 1959, one day before the effective date of the statute.
 This case involves legal relationships which were established when Ferrel was injured on June 11, 1957. Under the law as it existed on that date, as applied to the facts alleged in the pleadings, Ferrel had a claim against his employer for benefits under the Workmen's Compensation Act; Ferrel had a right to recover damages from Vegetable Oil; and Vegetable Oil had a right to be indemnified by the employer. The effect of section 3864, if applicable here, is to cut off Vegetable Oil's valuable right to go against Bay View.
 [7] In California Emp. etc. Com. v. Payne, 31 Cal.2d 210, 215 [187 P.2d 702], the court said: "Where a statute operates immediately to cut off an existing remedy and by retroactive application deprives a person of a vested right, it is ordinarily invalid because it conflicts with the due process clauses of the federal and state constitutions." Examples of the application of this rule are found in Wells Fargo & Co. v. City & County of San Francisco, 25 Cal.2d 37, 41 [152 P.2d 625], and Wexler v. City of Los Angeles, 110 Cal.App.2d 740 [243 P.2d 868].) [6b] This principle forbids the application of Labor Code, section 3864, to cut off Vegetable Oil's rights against Bay View. The duty of Bay View to hold Vegetable Oil harmless existed in 1957 (along with Vegetable Oil's correlative right) even though the right would not ripen into a cause of action for money until Vegetable Oil actually paid Ferrel.
 This is not inconsistent with the reasoning or the decision in Augustus v. Bean, 56 Cal.2d 270 [14 Cal.Rptr. 641, 363 P.2d 873]. There the Supreme Court held that Code of Civil Procedure, sections 875-880, enacted in 1957 to authorize contribution between joint tortfeasors, would permit contribution in 1958 with respect to a tort which occurred in 1956. In arriving at that conclusion the court said: *259
 "Our construction of section 880 [Code of Civ. Proc.] does not give rise to a problem of retroactive impairment of a vested right. As of the time of the accident a person did not have a vested right at common law to avoid paying for the consequences of his negligence merely because there were other tortfeasors involved. After the entry of a judgment against the joint tortfeasors, each of them was liable in full until the judgment was satisfied, and, if the plaintiff chose to collect from one to the exclusion of another, this was a matter of chance rather than the result of a right which became fixed as of the time of the accident. Contribution statutes, if applied where an accident antedates their enactment, do not retroactively increase the liability existing at the time of the injury but merely provide a method by which the liability of each of the tortfeasors may be limited to his pro rata share of the judgment." (56 Cal.2d at p. 272.)
 In the present case (unlike the Augustus case) Vegetable Oil had a right to shift the entire loss upon the tortfeasor who had created the dangerous condition. This was based upon then existing principles of substantive law, and not upon any fortuitous choice made by the injured party. In a situation such as is presented by this cross-complaint the policy of the law, in 1957, was not to treat the employer and the third party equally (as in the conventional case of joint tortfeasors) but to place the ultimate burden entirely upon one of them. The 1959 statute reversed this policy, leaving a substantial part of the loss with the third party by taking away his right of indemnification.
 [8] Petitioner complains also that the respondent court made an order that if it be determined in any appellate proceedings that the cross- complaint might be filed, then all proceedings on the cross-complaint shall be severed for separate trial. This type of order is within the trial court's discretion under Code of Civil Procedure, section 1048. (See Roylance v. Doelger, 57 Cal.2d 255, 261 [19 Cal. Rptr. 7, 368 P.2d 535].) This is a discretion which can best be exercised by a trial court after the pleadings are closed and the parties (including cross-defendants) are able to advise the court as to their plans for the trial. If at that time it should appear that the trial of the cross-complaint will not be so difficult as the law-and-motion judge supposed when he made his anticipatory ruling, the presiding *260 judge can make such further order as then seems appropriate. No direction from this court would be helpful on that subject.
 Let a peremptory writ of mandamus issue to require the respondent court to modify its order of October 3, 1962, so as to grant the motion of petitioner for leave to amend its answer and so as to grant the motion for leave to file a cross-complaint against Bay View. In other respects the petition is denied.
 Shinn, P. J., and Ford, J., concurred.
