
393 So.2d 1171 (1981)
PARKWAY GENERAL HOSPITAL, INC., Appellant,
v.
ALLSTATE INSURANCE COMPANY, Appellee.
No. 80-541.
District Court of Appeal of Florida, Third District.
February 10, 1981.
Atkinson, Golden, Bacen and Diner and Stephen F. Bacen, Hollywood, for appellant.
Spencer and Taylor and Arthur H. Taylor, Miami, for appellee.
Before HUBBART, C.J., and DANIEL S. PEARSON and FERGUSON, JJ.
FERGUSON, Judge.
Parkway General Hospital appeals a final order dismissing with prejudice its complaint *1172 against Allstate Insurance Company for payment of hospital bills. We reverse.
Paul Dowd, was injured while a passenger in a vehicle insured by Allstate. Dowd was admitted to Parkway on April 23, 1978, and incurred bills in excess of $65,000. At the time of his admission to the hospital, Dowd and a female companion who gave her name as Debi Dowd, purportedly signed an Agreement of Payment and Assignment of Insurance and Claim Benefits. The assignment authorized the insurer to make direct payment to the hospital of any benefits arising from the insurance policy. Allstate made payment for the hospital bills directly to Paul Dowd through his attorney, Michael Grossman, Esquire. Parkway brought suit against Dowd, his female friend Debi Dowd, Dowd's attorney and Allstate seeking direct payment of the hospital bill.
The complaint, under two separate theories, alleges that Allstate should have made payment directly to Parkway. In Count V Parkway alleges that the hospital is a third party beneficiary under the subject insurance policy. In Count VI Parkway alleges that by virtue of an assignment of insurance benefits the hospital is an assignee in interest of insurance benefits owed the insured.
Allstate was heard on its seven paragraph motion to dismiss Parkway's complaint. In paragraph one of the motion Allstate contends that a provider of medical services does not have a direct cause of action against the insurer of a patient for benefits payable to the patient under nofault law or under an automobile liability insurance policy. This argument has no application where there is an assignment of benefits by the insured to a third party. Nationwide Mutual Insurance Company v. McNulty, 229 So.2d 585 (Fla. 1969); W. Fla. Groc. Co. and H.T. Reddick v. Teutina Fire Ins. Co., 74 Fla. 220, 224, 77 So. 209, 210-11 (1917); Henry v. Halifax Hospital District, 368 So.2d 432 (Fla. 1st DCA 1979).
Allstate's second argument in support of its motion to dismiss is that no copy of the insurance policy was appended to the complaint as required by Fla.R.Civ.P. 1.130. In Count V of its complaint, however, Parkway alleges that the policy in question is in the sole and exclusive possession of one or more of the defendants and will be produced through discovery. Such an allegation precludes dismissal with prejudice. Sachse v. Tampa Music Co., 262 So.2d 17, 19 (Fla. 2d DCA 1972). Even without that allegation in the complaint, a prejudicial dismissal would have been improper. See, e.g., Conklin v. Cohen, 287 So.2d 56, 60 (Fla. 1973); Winn-Dixie Stores, Inc. v. Sams, 281 So.2d 47 (Fla. 3d DCA 1973).
Allstate's third argument is that the third party beneficiary theory asserted by plaintiff in Count V of the complaint cannot be extended to create some separate cause of action on behalf of the hospital or physician. Plaintiff concedes the correctness of that argument.
Allstate's arguments four, five and six all go to evidentiary matters extrinsic to the face of the complaint and should not have been considered in a motion to dismiss. Paragraph four refers to stipulations and orders of dismissal entered in companion cases. Paragraph five pertains to a hold-harmless agreement between defendants Dowd and his attorney and plaintiffs Allstate and Allstate's insureds. Paragraph six refers to releases signed by the defendant Dowd to Allstate and the owner and the operator of the vehicle in which Dowd was a passenger when injured. Paragraph seven argues that plaintiff's cause of action should be against Dowd and not against Allstate.
The purpose of a motion to dismiss is to ascertain if plaintiff has alleged a good cause of action, and the court must confine itself strictly to allegations within the four corners of the complaint. Consideration of defendant's affirmative defenses or sufficiency of evidence which plaintiff will likely produce on the merits is wholly irrelevant and immaterial to deciding a motion to dismiss. Pizzi v. Central Bank & Trust Co., 250 So.2d 895, 897 (Fla. 1971); Kest v. Nathanson, 216 So.2d 233, 235 (Fla. 4th DCA *1173 1968); Stone v. Stone, 97 So.2d 352 (Fla. 3d DCA 1957). Parkway's allegation of assignment in Count VI of its complaint is sufficient to state a cause of action against Allstate as required by Fla.R.Civ.P. 1.110.
Accordingly the final order appealed, to the extent that it dismisses the complaint as to Allstate Insurance Company, is reversed except as to the third party beneficiary claim in Count V.
Affirmed in part, reversed in part, and remanded for further proceedings consistent with this opinion.
