
228 Cal.App.3d 1601 (1991)
279 Cal. Rptr. 877
A. JOSEPH KILLIAN et al., Plaintiffs and Appellants,
v.
WILLIAM H. MILLARD et al., Defendants and Respondents; THOMAS F. CAMP et al., Claimants and Appellants.
Docket No. A036176.
Court of Appeals of California, First District, Division One.
April 8, 1991.
*1603 COUNSEL
Thomas F. Camp, in pro. per., MacGregor & Buckley, John F. MacGregor, Daniel U. Smith and Edward S. Willner for Plaintiffs and Appellants and for Claimants and Appellants.
Terry M. Giles, Thomas J. Purcell and Catherine D. Purcell for Defendants and Respondents.
*1604 OPINION
STEIN, J.
A. Joseph Killian and Bruce Van Natta appeal from the order of the trial court voiding contracts they had entered into with persons not parties to their lawsuit and ordering them to repay with interest such money as they had received pursuant to those contracts. We will reverse the judgment, finding that the court had no power to void the agreements.
Killian and Van Natta (hereafter referred to as Syndicators) filed a complaint against William H. Millard et al. (Millard) alleging the breach of an agreement to transfer to Syndicators an interest in a corporation owned by Millard. Unable to personally finance their lawsuit, they syndicated it by creating 50 "units" for sale at $10,000 per unit with a 2-unit minimum per investor. A number of persons (Investors) (Thomas F. Camp et al.) entered into a "Recovery Participation Agreement" with Syndicators by which they purchased units at the stated price in return for which they received the right to a percentage share in the net profits of the lawsuit.
In the course of conducting discovery, Millard learned of the syndication. He thereafter filed in the superior court a "Motion in Limine Concerning the Syndication of Interests in a Lawsuit as a Violation of Public Policy" in which he argued, among other things, that the contract between Syndicators and Investors violated public policy and therefore should be prohibited.
The superior court found that the recovery participation agreement and a related "Confidential Disclosure Document" violated public policy "in the following respects:
"a. it discourages settlements;
"b. it foments litigation; and
"c. it interferes with the orderly process of the courts and litigation." On these findings the court declared the recovery participation agreements null and void and ordered Syndicators to provide proof that they had repaid Investors all sums invested together with interest. The Investors were not party to these proceedings. Syndicators, however, then filed a motion for reconsideration at which the Investors made a "special appearance" and were permitted to argue their position. The motion was denied.

DISCUSSION
(1a) The case before the trial court was an action initiated by the Syndicators' complaint against Millard. The contract between the Syndicators *1605 and the Investors was not relevant to any issues in that action. The sole basis for the trial court's consideration of the contract between Syndicators and Investors was Millard's objection to it.
(2) It is well settled that only parties with a real interest in a dispute have standing to seek its adjudication. (Code Civ. Proc., § 367.) A real party in interest ordinarily is defined as the person possessing the right sued upon by reason of the substantive law. (Powers v. Ashton (1975) 45 Cal. App.3d 783, 787 [119 Cal. Rptr. 729].) "The question of standing to sue is one of the right to relief and goes to the existence of a cause of action against the defendant (cf. Los Angeles Fire & Police Protective League v. Rodgers, [1970] 7 Cal. App.3d 419, 423 [86 Cal. Rptr. 623]." (Payne v. United California Bank (1972) 23 Cal. App.3d 850, 859 [100 Cal. Rptr. 672].) "The right to relief ... goes to the existence of a cause of action ... Where the complaint states a cause of action in someone, but not in the plaintiff, a general demurrer for failure to state a cause of action will be sustained." (Parker v. Bowron (1953) 40 Cal.2d 344, 351 [254 P.2d 6]).)
Millard had no substantive right in the contract between Syndicators and Investors. He lacked standing to seek to void that contract. (3) Lack of standing is not waived by the failure to raise it in the trial court; it may be raised at any point in the proceedings. (Code Civ. Proc., § 430.80; Parker v. Bowron, supra, 40 Cal.2d at p. 351.)
(1b) That Millard lacked standing is not the only reason for concluding that the court had no power to hear the cause. A person who in fact is a real party in interest is entitled to seek an adjudication of that interest by filing an appropriate pleading in the proper court. Thus, assuming that Millard had the standing to attack the recovery participation agreement, he could seek the court's review of the agreement by filing a complaint in a separate action or by filing a cross-complaint in the action here at issue. A cross-complaint, however, can be filed against a person not already a party only if the cause of action asserted therein "(1) arises out of the same transaction, occurrence, or series of transactions or occurrences as the cause brought against [the cross-complainant] or (2) asserts a claim, right, or interest in the property or controversy which is the subject of the cause brought against him." (Code Civ. Proc, § 428.10, subd. (b).) Millard did not, of course, initiate an action against the contract by complaint. He neither filed a cross-complaint nor had he the power to do so, as the subject he sought to adjudicate did not bear the requisite relationship to the underlying action.[1]
*1606 Lacking the standing or authority to attack the contract by ordinary means, Millard attacked it simply by filing a motion. The issue, however, is not one which ordinarily would be subject to a motion. (4) "A motion is not an independent right or remedy; it is confined to incidental matters in the progress of a cause. A motion relates to some question that is collateral to the main object of the action and is connected with and dependent upon the principal remedy. [Citation.] It is not consonant with regular procedure to raise in a motion wholly distinct and independent matters which generally should be the subject of a formal petition or complaint. [Citation.]" (Donald J. v. Evna M. (1978) 81 Cal. App.3d 929, 934 [147 Cal. Rptr. 15].)
(5a), (6) It is true that a trial court has limited power to control the proceedings before it to ensure the orderly administration of justice. Thus, Code of Civil Procedure section 128, subdivision (a)(5) confers authority upon the trial court to "control in furtherance of justice, the conduct of its ministerial officers, and of all other persons in any manner connected with a judicial proceeding before it, in every matter pertaining thereto." Further, the court has analogous equitable powers by which, for example, it may enjoin an attorney from appearing in an action against a former client. (Meehan v. Hopps (1955) 45 Cal.2d 213, 215 [288 P.2d 267]; Big Bear Mun. Water Dist. v. Superior Court (1969) 269 Cal. App.2d 919, 927 [75 Cal. Rptr. 580].)
The Syndicators and their attorneys were connected with the action before the trial court and thus subject to the court's incidental powers. There is little question but that the court had the power to ensure that the prosecution of the action was not tainted by outside pressures. Thus a court's incidental powers permit it, in an appropriate case, to disqualify an attorney for a conflict of interest. (Mills Land & Water Co. v. Golden West Refining Co. (1986) 186 Cal. App.3d 116, 126 [230 Cal. Rptr. 461]; William H. Raley Co. v. Superior Court (1983) 149 Cal. App.3d 1042, 1048 [197 Cal. Rptr. 232].) Accordingly, the trial court here had the power to compel the attorneys to choose between refunding the money or disqualification if, for example, it determined that because the Investors were paying them, they owed a duty to the Investors which conflicted with the duty owed to their clients. Further, the court had the power to dismiss the matter as frivolous or on the grounds of nonjusticiability, had it determined that the case was brought not because of any belief in its merits but purely as an investment. *1607 (See Code Civ. Proc., § 128, subd. (5); Jennings v. Strathmore Public etc. Dist. (1951) 102 Cal. App.2d 548, 551 [227 P.2d 838].) (7) (See fn. 2.), (5b) There is no authority, however, by which a court's incidental powers extend so far as to permit it to void an agreement between a party to the action and a stranger on the grounds of public policy.[2] If a contract violates public policy, the remedy is to decline to enforce it. If there is a matter which taints a trial, the remedy is to decline to go forward until the taint has been removed or, if it cannot be removed, to decline to go forward at all.
In summary, (1) Millard lacked standing to attack the contract between the Syndicators and the Investors, (2) the trial court lacked the power to issue an order affecting the Investors because the matter was not properly raised by appropriate pleading, (3) the order issued by the court extended beyond the incidental powers granted to it for purposes of ensuring the orderly administration of justice.

CONCLUSION
The judgment is reversed. Costs are awarded to appellants.
Newsom, Acting P.J., and Dossee, J., concurred.
NOTES
[1]  In jurisdictions other than California, which prohibit the assignment of legal claims, there is a split in authority over whether a defendant, in an action brought by an illegal assignee, is entitled to raise the assignment as a defense. A number of jurisdictions hold that a defense cannot be maintained because the question of the illegality of the assignment has nothing to do with the purpose of the suit. Those jurisdictions which do permit the defense appear to do so on the grounds that a plaintiff has to prove its entitlement to the right at issue. As an assignee has no such entitlement, the defendant should be able to show that the plaintiff is in fact an assignee. Such reasoning does not apply here where the right of the plaintiffs to bring the instant action is unquestioned. (See, generally, Annot., Assertion of Defense of Champerty in Action by Champertous Assignee (1952) 22 A.L.R.2d 1000.)
[2]  Contrast the situation presented where a plaintiff has entered into a settlement with one defendant and the trial court has the statutory power to determine if it was entered into in good faith. The purpose is not to interfere with the right of contract  a finding that the settlement was not in good faith does not invalidate the settlement. Where, however, the settlement is adjudicated not to have been in good faith, the defendant will not be shielded from subsequent liability for contribution or partial indemnity. (Code Civ. Proc., §§ 877, 877.6; Singer Co. v. Superior Court (1986) 179 Cal. App.3d 875, 886 [225 Cal. Rptr. 159].)
