
267 Cal.App.2d 569 (1968)
WALTER RUDOLPH DUNZWEILER, Petitioner,
v.
THE SUPERIOR COURT OF ALAMEDA COUNTY, Respondent; JOHNNIE A. HOUFF et al., Real Parties in Interest.
Civ. No. 25858. 
California Court of Appeals. First Dist., Div. One.  
Nov. 22, 1968.
 Low & Ball and David B. Lynch for Petitioner.
 No appearance for Respondent.
 William D. Corbett for Real Parties in Interest.
 MOLINARI, P. J.
 The question presented on this appeal is whether the respondent superior court abused its discretion by denying petitioner leave to file a cross- complaint in an action for damages for personal injuries and property damage. We have concluded that the court did abuse its discretion under the circumstances hereinafter set forth, and that a peremptory writ of mandate should issue to compel the filing of the proposed pleading.
 On April 14, 1967 an action was filed against petitioner and his wife seeking damages for personal injuries resulting from an automobile accident. The complaint alleged that on February 22, 1967 plaintiffs were proceeding in a northerly direction on the Warren Freeway in Oakland when they were struck from behind by a vehicle owned and operated by petitioner.petitioner and his wife filed an answer on June 6, 1967, alleging as a defense that the vehicle occupied by plaintiffs made a U-turn across the freeway divider and proceeded directly into their path.
 Following the filing of the answer, discovery proceedings were commenced, and the depositions of plaintiffs and an independent witness to the accident were taken. The witness' testimony corroborated petitioner's defense. Plaintiffs did not seek petitioner's deposition, and petitioner and his wife had no communication with their counsel and took no further action on the case during 1967.petitioner, during that time, attempted to negotiate a direct settlement with plaintiffs' insurance carrier, but his attempts were unsuccessful.
 On February 26, 1968 attorneys for petitioner received a letter from petitioner's wife advising them that petitioner had sustained personal injuries, medical expenses, loss of earnings and property damage as a result of the accident in *574 question. The letter acknowledged that it was "quite late," but explained that defendants "kept hoping that after the deposition that the American Automobile Association would realize that their client, Mr. Houff, was at fault and would make a settlement, and that we would not have to sue ... but it looks as if we have to." The letter then requested the attorneys to "represent us in our suit."
 On March 1, 1968 the respondent court mailed a notice of trial setting conference to counsel. The conference was scheduled for May 6, 1968. Thereafter attorneys for petitioner communicated with attorneys for plaintiffs by telephone and requested them to stipulate to the filing of a cross-complaint on petitioner's behalf. Attorneys for plaintiffs agreed to so stipulate, but indicated that they would prefer the request to be made by letter in order to maintain a proper record. Accordingly, on April 24, 1968, attorneys for petitioner requested the stipulation by mail. Attorneys for plaintiffs, by letter dated April 29, 1968, responded that they had no objection to the filing of a cross-complaint and would be willing to so stipulate.
 The trial setting conference was held on May 6, 1968, as previously scheduled. Neither petitioner nor his attorneys appeared. At that time trial was set for July 24, 1968.
 On May 7, 1968 counsel for petitioner mailed the stipulation regarding the filing of the cross-complaint to plaintiffs' attorneys. On May 16, 1968 attorneys for plaintiffs, claiming "oversight" and "error," withdrew their consent to said stipulation. Thereafter, on May 27, 1968, petitioner's attorneys noticed a motion before respondent court to allow the filing of a cross-complaint for personal injuries and property damages resulting from the accident. This motion came on for hearing on June 18, 1968, at which time the trial judge requested that petitioner submit medical reports of his injuries and an itemization of the expenses alleged to have been incurred as a result of the accident.pursuant to this request, petitioner submitted, on June 20, 1968, a copy of the medical report and bill received by petitioner from his treating physician, and a declaration of petitioner and his attorney relating to the reasons for delay in seeking the cross-complaint. The trial judge thereupon took the motion under submission.
 On July 12, 1968 petitioner filed a notice of motion for continuance of trial. The motion came on for hearing on July 22, 1968 before the same judge who had heard the motion for leave to file a cross-complaint, at which time he informed *575 counsel that petitioner's motion to file a cross- complaint had been denied by minute order dated July 19, 1968. The court advised counsel that denial of the motion was based on findings that petitioner's attorneys were dilatory in seeking court intervention, that petitioner was negligent in failing to advise his attorney that he desired to cross-complain, and that the cross-complaint was without merit.
 [1] Adverting to the question presented, we first note that petitioner's pleading, although designated as a cross-complaint, seeks to assert a claim which could have been pleaded as either a counterclaim or a cross-complaint. (See Schrader v. Neville, 34 Cal.2d 112, 114 [207 P.2d 1057].) It embraces the elements of a counterclaim as set forth in Code of Civil Procedure section 438  [fn. 1] in that it tends to diminish or defeat plaintiff's recovery and exists in favor of a defendant as against a plaintiff between whom several judgments might be had in the action. It also satisfies the elemental requirements of a cross-complaint in that defendant seeks affirmative relief against a party to the original action, relating to the transaction, matter, happening, or accident upon which the action is brought. (See  442.) Accordingly, a reviewing court may, in its discretion, treat the claim asserted as either a counterclaim or a cross- complaint to the end that substantial justice may be done. (Schrader v. Neville, supra.)
 [2] It should also be noted that the claim asserted by petitioner comes within the ambit of section 439 which provides: "If the defendant omits to set up a counterclaim upon a cause arising out of the transaction set forth in the complaint as the foundation of the plaintiff's claim, neither he nor his assignee can afterwards maintain an action against the plaintiff therefor." (Schrader v. Neville, supra, 34 Cal.2d 112, 114.) Accordingly, in the instant case, petitioner's claim must have been pleaded by him in plaintiffs' action in order to prevent the operation of section 439. (See Schrader v. Neville, supra, at pp. 114-115; Todhunter v. Smith, 219 Cal. 690, 693-694 [28 P.2d 916].)
 [3, 4] With respect to cross-complaints, we also note the rule that a defendant may file a cross-complaint at the time of answering, but thereafter it may only be done by permission of the court; and that the ruling of the trial court on an application for permission to file such a pleading is within its discretion and will be reversed only upon a showing that such *576 discretion was abused. (Nels E. Nelson, Inc. v. Tarman, 163 Cal.App.2d 714, 730 [329 P.2d 953]; Glogau v. Hagan, 107 Cal.App.2d 313, 320 [237 P.2d 329]; Gallo v. Boyle Mfg. Co., Inc., 30 Cal.App.2d 653, 655-656 [86 P.2d 1067];  442.) Insofar as the filing of a counterclaim is concerned, the rule is substantially the same. (Glogau v. Hagan, supra.) [5] Moreover, since a counterclaim is an integral part of the answer ( 437; see Case v. Kadota Fig Assn., 35 Cal.2d 596, 603 [220 P.2d 912]), the filing of a counterclaim subsequent to the filing of the answer must be accomplished by amending the latter pleading. [6] Accordingly, a trial court is authorized to permit substantive amendments to pleadings "in its discretion." ( 473; Hayutin v. Weintraub, 207 Cal.App.2d 497, 505 [24 Cal.Rptr. 761]; Landis v. Superior Court, 232 Cal.App.2d 548, 554 [42 Cal.Rptr. 893].) [7] To defeat the trial court's ruling in such a case it must be shown that the court clearly abused its discretion. (Glogau v. Hagan, supra, at p. 320; Anderson v. Perminter, 78 Cal.App.2d 378, 380 [177 P.2d 818]; Hyman v. Tarplee, 64 Cal.App.2d 805, 813-814 [149 P.2d 453]; Manha v. Union Fertilizer Co., 151 Cal. 581, 584 [91 P. 393].)
 [8] With respect to the amendment of pleadings there has developed in this state a policy of great liberality in allowing amendments at any stage of the proceeding so as to dispose of cases upon their substantial merits where the authorization does not prejudice the substantial rights of others. (Hayutin v. Weintraub, supra, 207 Cal.App.2d 497, 505; Rabe v. Western Union Tel. Co., 198 Cal. 290, 300 [244 P. 1077]; Golden v. Penland, 143 Cal.App.2d 583, 588 [300 P.2d 279]; Bank of America etc. Assn. v. Goldstein, 25 Cal.App.2d 37, 46 [76 P.2d 545]; McDougald v. Hulet, 132 Cal. 154, 162 [64 P. 278].) The rule of liberality is particularly important where, as in the present case, an amendment is sought to an answer. (Gould v. Stafford, 101 Cal. 32, 34 [35 P. 429]; Hyman v. Tarplee, supra, 64 Cal.App.2d 805, 813-814.)
 Although the policy of liberality is firmly entrenched in case law, it is tempered by the rule that the trial court's decision must be upheld unless there is a clear abuse of discretion. (Hayutin v. Weintraub, supra, 207 Cal.App.2d 497, 505-506; Golden v. Penland, supra, 143 Cal.App.2d 583, 588.) The court's discretion, however, must be sound and reasonable. [9] As stated in Morgan v. Superior Court (1959) 172 Cal.App.2d 527 at page 530 [343 P.2d 62], "... it is a rare case in which 'a court will be justified in refusing a party leave to amend his pleadings so that he may properly present his *577 case.' [Citations.] [10] If the motion to amend is timely made and the granting of the motion will not prejudice the opposing party, it is error to refuse permission to amend and where the refusal also results in a party being deprived of the right to assert a meritorious cause of action or a meritorious defense, it is not only error but an abuse of discretion. [Citations.]" (See Daum v. Superior Court (1964) 228 Cal.App.2d 283, 289 [39 Cal.Rptr. 443]; Saari v. Superior Court (1960) 178 Cal.App.2d 175, 180 [2 Cal.Rptr. 856].) [11] And as stated in Jepsen v. Sherry (1950) 99 Cal.App.2d 119, 121 [220 P.2d 819], the discretion to be exercised by trial courts is "one controlled by legal principles and is to be exercised in accordance with the spirit of the law and with a view to subserving, rather than defeating, the ends of substantial justice."
 Adverting to the instant case, we deem it proper, to the end that substantial justice may be done, to treat the subject pleading as a counterclaim so as to bring into play the rule of liberality applicable to the amendment of pleadings. We are impelled to do so because petitioner's claim is deemed a counterclaim under section 439 which effectively bars the claim unless the filing of the pleading is permitted.
 In deciding whether to uphold denial of a request to amend a pleading, California courts have focused attention on two aspects of the case: the subject matter of the proposed amendment, and the conduct of the parties. [12] As aptly stated in Landis v. Superior Court, supra, 232 Cal.App.2d 548 at pages 554-555, "If the subject matter raises a disfavored plea, is insufficient to state a cause of action or defense, contradicts an admission in the original pleading without a showing of mistake or excuse, or changes the cause of action, denial is upheld. [Citation.] If the conduct of the party shows long unexplained and unexcused delay, and particularly where it is indicative of bad faith or the delay would necessitate continuance, denial has been upheld. [Citation.]"  [fn. 2]*578
 [13a] With regard to the subject matter of the proposed pleading in the present case, the trial court found it to be "without merit." A review of the record, however, reveals no basis for such a determination, since the pleading is sufficient, as either a cross-complaint or counterclaim, to establish a cause of action in negligence. [14] All the necessary elements for such an action are alleged, to wit: (1) that plaintiffs owed a duty of care toward defendant; (2) that plaintiffs breached that duty; (3) that defendant was injured as a result of the breach; and (4) that defendant incurred damage as a result of the breach. [13b] Moreover, petitioner alleged, in support of his motion, that he, his wife, and an independent witness will testify to plaintiffs' negligence at the time of the accident. This allegation was not controverted. We conclude, therefore, that the proposed pleading does not raise a disfavored plea.
 [15a] The question of the propriety of the trial court's order becomes more difficult when the conduct of the parties is considered. It is stated in 2 Witkin, California Procedure (1954) page 1608, that "The cases [denying leave to amend] do not always make it clear whether they rest upon (1) the subjective element of lack of diligence in discovering the facts or in offering the amendment after knowledge of them, or (2) the effect of the delay on the adverse party. But in most cases both factors are involved." In Landis, the reviewing court after pointing out that most cases which uphold the trial court's denial of a motion to amend involve motions noticed at a late stage of the proceeding, usually at or just before trial, makes this pertinent statement: "... it seems unreasonable to deny a party the right to amend where the only apparent hardship to the defendants is that they will have to defend." (232 Cal.App.2d 548 at p. 557.)  [fn. 3]
 Plaintiffs do not allege harm from the fact that the proposed *579 cross-complaint or counterclaim might be allowed. The counterclaim was essentially based on facts already pleaded by petitioner and his wife as a defense in their answer. The only possible hardship might be a postponement of the trial, although such a postponent may not be necessary if the proposed pleading is deemed a counterclaim, since no response is needed to a counterclaim. (Edgar Rice Burroughs, Inc. v. Commodore Productions & Artists Inc., 167 Cal.App.2d 463, 474 [334 P.2d 922].) [16] Moreover, the fact that an amendment necessitates a continuance does not necessarily furnish a sufficient reason for refusing the right to amend. (Davies v. Symmes, supra, 49 Cal.App.2d 433, 444; McDougald v. Hulet, supra, 132 Cal. 154, 161.)
 [15b] Petitioner's delay in seeking the cross-complaint, furthermore, is neither unexplained nor unexcused. [17] Petitioner filed his answer to the complaint on June 6, 1967. The attorneys engaged to defend him in that action were then apparently employed only to defend the case. The settlement negotiations for his injuries were undertaken by petitioner himself. On February 26, 1968, some eight months after the answer had been filed, when it became apparent that no settlement could be reached, petitioner directed his attorneys in the present action to bring suit against plaintiffs.  [fn. 4] Based upon the well-established policy of law that favors the avoidance of litigation by compromise, cases similar to the one at bench have held that delays caused by such negotiations are excusable. (Jepson v. Sherry, supra, 99 Cal.App.2d 119, 121 [abuse of discretion to dismiss action for want of prosecution for two years during which the parties had engaged in settlement talks]; Forneris v. Krell, 69 Cal.App.2d 280 [158 P.2d 937] [abuse of discretion to dismiss an action because of delay in the service of summons when the delay was largely due to negotiations between the parties for a settlement and did not prejudice the opposing party]; Ferris v. Wood, 144 Cal. 426, 429 [77 P. 1037] [abuse of discretion to dismiss when delay was caused by settlement negotiations].
 When the settlement negotiations failed, petitioner's attorneys sought a stipulation from plaintiffs' attorneys for the filing of the cross-complaint. Pursuant to this request plaintiffs' attorneys agreed to enter into such a stipulation. At the trial setting conference of May 6, 1968, at which petitioner's attorneys did not appear, plaintiffs' attorneys apparently did *580 not advise the court of the fact that they had previously agreed to enter into a stipulation for the filing of a cross-complaint, although under the circumstances it was incumbent upon them to do so. Instead, they permitted the trial court to set the case for trial on July 24, 1968. On May 16, 1968, plaintiffs' attorneys reneged on their agreement to enter into the stipulation.petitioner was therefore left no choice but to seek court assistance. Accordingly, he filed the instant motion which was noticed for hearing almost two months before the date set for trial.
 Under the foregoing circumstances it cannot be contended that the period elapsing between the request for the stipulation and its repudiation should be charged to petitioner. As to the remaining 10-month period, approximately 8 months are reasonably accounted for and excused since they were consumed by settlement negotiations. Accordingly, there remains two months which are unaccounted for, i.e., those months elapsing between the time petitioner retained his attorneys to bring a countersuit and the time they requested the stipulation. In the light of the policy of the law seeking the determination of causes on their merits, we cannot say that this delay amounts to a lack of due diligence.
 It should be noted here that in Landis the court stated that no California decision has upheld the denial of a motion to amend based solely on the fact that a party lacked diligence at a stage of the proceeding before trial or pretrial had been set. The facts of the present case indicate that petitioner sought relief well before trial date was set. The fact that the actual motion was made after trial was set was due to the refusal of plaintiffs' attorneys to accept the stipulation. Since plaintiffs' attorneys were largely to blame for the delay, they should not be allowed, in this proceeding, to take advantage of their adversary's unfortunate position. [18] " 'In view of the policy of the law to have every litigated case tried on its merits, courts look with disfavor on a party who, regardless of the merits of his case, attempts to take advantage of the mistake, surprise, inadvertence, or neglect of his adversary.' " (Luther v. Foster, 150 Cal.App.2d 725, 728 [310 P.2d 655].)
 [15c] The denial of petitioner's motion, furthermore, unreasonably penalizes petitioner for any lack of diligence on his part. His counterclaim is compulsory and must be filed in the present action. If it is not filed, petitioner's cause of action is barred forever. In view of the policy in favor of *581 allowing issues to be fully litigated, and because the trial court's order, if upheld, would deny petitioner his day in court, said order does not tend to subserve, but rather to impede or defeat, the ends of substantial justice.  [fn. 5] For this and other reasons noted above, the order should be vacated.
 Let a peremptory writ of mandate issue requiring the respondent court to make and enter its order granting leave to petitioner to file the proposed cross-complaint tendered by him as an amendment to the answer by way of a counterclaim.
 Sims, J., and Elkington, J., concurred.
NOTES
[fn. 1]  1. Unless otherwise indicated, all statutory references are to the Code of Civil Procedure.
[fn. 2]  2. Examples of cases upholding the denial of leave to file a cross-complaint and denial of leave to amend are as follows: Scholle v. Finnell (1914) 167 Cal. 90, 102 [138 P. 746] [unreasonable and unexplained delay in requesting amendments]; Bank of America etc. Assn. v. Goldstein, supra, 25 Cal.App.2d 37, 48 [unreasonable delay in requesting an amendment to an answer]; Davies v. Symmes (1942) 49 Cal.App.2d 433, 444 [122 P.2d 102] [long and unexcused delay, prejudice to opposing party]; Anderson v. Perminter, supra, 78 Cal.App.2d 378, 380 [unexcused delay]; Glogau v. Hagan, supra, 107 Cal.App.2d 313, 320 [unexcused delay, proposed cross-complaint was demurrable, prior action based upon the causes of action alleged in the cross-complaint still pending, causes of action alleged in cross-complaint assigned to another party]; Golden v. Penland, supra, 143 Cal.App.2d 583, 588 [prior actions brought on identical facts, prejudice to opposing party]; Nels E. Nelson, Inc. v. Tarman, supra, 163 Cal.App.2d 714, 730 [unexcused delay, unnecessary confusion of issues]; Hayutin v. Weintraub, supra, 207 Cal.App.2d 497, 506 [unexcused delay, allegations and affidavit in support of motion to amend vague, continuance required if motion granted]; United States Nat. Bank v. Bank of America (1963) 214 Cal.App.2d 74, 76 [29 Cal.Rptr. 277] [unexcused delay, request to amend not properly made].
[fn. 3]  3. See, for example, Anderson v. Perminter, supra, 78 Cal.App.2d 378, 380 [motion to amend made on day of trial]; Davies v. Symmes, supra, 49 Cal.App.2d 433, 436 [motion to amend made on day of trial]; Bank of America etc. Assn. v. Goldstein, supra, 25 Cal.App.2d 37, 48 [motion made on the morning of trial].
[fn. 4]  4. These allegations in petitioner's affidavit are uncontradicted and therefore must be taken as true.
[fn. 5]  5. In Landis v. Superior Court, supra, 232 Cal.App.2d 548, 555, it was noted that "... reversals on appeal are common where the court denies leave to amend and the appellant makes a reasonable showing of prejudice from the ruling. [Citations.]"
