
15 So.3d 501 (2009)
Mary MEDLOCK, Cassandra Cooper, Johnnie Baker, and the estate of Keith Cooper
v.
SAFEWAY INSURANCE COMPANY OF ALABAMA.
1071303.
Supreme Court of Alabama.
January 30, 2009.
*503 Scott M. Speagle of Hill, Hill, Carter, Franco, Cole & Black, P.C., Montgomery, for appellants.
Robert C. Ward, Jr., and Bethany L. Bolger of Rushton, Stakely, Johnston & Garrett, P.A., Montgomery, for appellee.
STUART, Justice.
Safeway Insurance Company of Alabama sued policy owners Mary Medlock and Cassandra Cooper, seeking a judgment declaring that it did not owe underinsured-motorist benefits to Johnnie Baker and the estate of Keith Cooper. The trial court entered a judgment for Safeway; Medlock, Cooper, Keith Cooper's estate, and Baker appeal. We reverse and remand.

Facts and Procedural History
On October 11, 2006, Safeway issued an automobile insurance policy to Medlock. On October 12, 2006, Safeway issued a renewal policy for automobile insurance to Cooper. The declaration in both policies provided:
"By acceptance of this policy you agree:
". . . .
"4. that the coverage afforded by the policy shall not apply to any loss or damage arising from any accident which occurs while any automobile is being driven, operated, manipulated, maintained, serviced, or used in any other manner by an unlisted driver, on the Application, Declarations, and/or on the Endorsement, under the age of twenty-five(25), who resides in the same household as the named insured, and/or is a regular or frequent operator of any automobile insured under this policy. This exclusion shall apply whether or not the named insured is occupying any automobile at the time said driver is using it in any manner whatsoever."
With regard to uninsured-motorist coverage, both policies provided:
"Part C  Uninsured Motorist Coverage Insuring Agreement
"We will pay damages which a Covered Person, as defined in this Part, is legally entitled to recover from the owner or operator of an uninsured motor vehicle because of bodily injury:
"1. Sustained by a Covered Person; and
"2. Caused by an accident, which in no way involves the operation of any automobile by a Non-Covered Person, as defined in this Part;
"The owner's or operator's liability for these damages must arise out of the ownership, maintenance or use of the uninsured motor vehicle.
"Any judgment for damages arising out of a suit brought without prior notice to us, and without our written consent is not binding on a claim being made by any Covered Person, as defined in this Part, against us. A default judgment rendered against the owner or operator of an uninsured motor vehicle shall not be binding nor determinative of any issue arising in a claim being made by any Covered Person, as defined in this Part.

*504 "No recovery can be made under this Part until the Covered Person has received by way of settlement or judgment, the full limits of coverage under any applicable bodily injury liability policy or bond.
"`Covered Person' as used in this Part means:
"1. You, and a Family Member[1] other than a Non-Covered Person
"2. Any other person occupying Your Covered Auto (provided it is not operated by a Non-Covered Person)
"`Non-Covered Person' as used in this Part means an operator of any automobile who:
"1. Is a Family Member or is otherwise a member of your household under the age of twenty and is not listed on the Application, Declarations and/or added by Endorsement.
"2. Is listed as an `Excluded Driver(s)' on the Application, Declarations and/or added by Endorsement.
"3. Is a regular and frequent user of Your Covered Auto and not listed on the Application, Declarations and/or by Endorsement.
"`Uninsured Motor Vehicle' means a land motor vehicle or trailer of any type:
"1. To which no bodily injury liability bond or policy is in effect at the time of the accident.
"2. To which a bodily injury liability bond or policy is in effect at the time of the accident but the sum of the limits of liability coverage under all policies is less than the damages which the injured person is legally entitled to recover from the owner or operator of the uninsured motor vehicle.
"3. Which is a hit and run vehicle whose operator or owner cannot be identified and which hits or which causes an accident resulting in `bodily injury' without hitting. If there is no physical contact with the hit and run vehicle the fact of the accident must be corroborated by competent evidence other than testimony of any person making a claim under this or any other similar insurance as a result of such accident.
"However, `Uninsured Motor Vehicle' does not include any vehicle or equipment:
"1. Identified as `Your Covered Auto' on the Application, Declarations, and/or by Endorsement.
"2. Owned by or furnished or available for the regular use of you or any Family Member.
"3. Operated by Non-Covered Person.
"4. Operated on rails or crawler treads.
"5. Which is a farm type tractor or equipment designed mainly for use off public roads except while on public roads.
"6. While located for use as a residence or premises.
"EXCLUSIONS
"A. We do not provide Uninsured Motorist Coverage for bodily injury sustained by any person:
"1. During or as a result of operation of any automobile by a Non-Covered Person.
"2. If that person or the legal representative settles the bodily injury *505 claim without notice to us and our consent.
"3. While occupying Your Covered Auto when it is being used to carry persons or property for a fee. This exclusion does not apply to a share-the-expense car pool.
"4. Using a vehicle without a reasonable belief that the person is entitled to do so.
"5. Using a vehicle in the commission of a crime, other than a traffic violation.
"6. Who is an unlicensed driver or whose driving privileges have been terminated and/or suspended.
"B. This coverage shall not apply directly or indirectly to benefit an insurer or self-insurer under any of the following or similar laws:
"1. workers' compensation law; or
"2. disability benefit law."
On October 25, 2006, Keith Cooper, Cassandra Cooper's brother, was driving the automobile described in Medlock's Safeway policy. Johnnie Baker was a passenger in the vehicle. The automobile Keith Cooper was driving was involved in an accident with an automobile driven by Sean Cardell Dees. Keith Cooper died as a result of the accident, and Baker sustained injuries.
Keith Cooper's estate and Baker were paid the limits of Dees's insurance policy. Keith Cooper's estate then made a claim for underinsured-motorist coverage on both Medlock's and Cooper's Safeway policies, and Baker made a claim for underinsured-motorist coverage on Medlock's Safeway policy.
On March 2, 2007, after the claims were made, Safeway filed an action, naming as defendants Medlock and Cooper and seeking a declaration that it did not owe underinsured-motorist benefits to either Keith Cooper's estate or Baker. Safeway averred that Keith Cooper was not a licensed driver at the time of the accident, that Medlock was not a passenger in the vehicle at the time of the accident, that Keith Cooper did not have Medlock's permission or authorization to drive her vehicle at the time of the accident, that Keith Cooper is Cooper's brother, and that Keith Cooper was not listed as an insured driver on the application or declarations of, and was not added by endorsement to, either policy. Safeway further averred that because its policies excluded from coverage an unlicensed operator of the insured vehicle; a driver "using the vehicle without a reasonable belief that the person is entitled to do so"; a family member who is not listed on the application or declarations of the policy and/or was not added by endorsement; or a regular and frequent user of the insured vehicle who is not listed on the application or declarations of the policy and/or was not added by endorsement, it did not owe any benefits as a result of the October 25, 2006, accident. Safeway attached to its complaint copies of the policies issued to Medlock and Cooper. Safeway also attached documents establishing that Keith Cooper was not listed as a driver in the application or declarations of either policy and that he had not been added by endorsement.
Medlock and Cooper filed an answer and counterclaim. In their answer, Medlock and Cooper admitted that Keith Cooper was driving Medlock's vehicle, that Medlock was not a passenger in the vehicle at the time of the accident, and that Keith Cooper was Cooper's brother. Medlock and Cooper denied that Keith Cooper was an unlicensed driver at the time of the accident, denied Safeway's allegation that Medlock had not given Keith Cooper permission to drive the vehicle, and denied Safeway's allegation that Keith Cooper is *506 not listed as a driver on either Medlock's or Cooper's application for her policy or on the endorsement. Medlock and Cooper also asserted an affirmative defense that the "action is improper as the real parties in interest have not been made parties to the suit."
In their counterclaim, they alleged that Keith Cooper and Baker were covered persons under both Medlock's and Cooper's policies and that Safeway had improperly denied the estate's and Baker's claims for coverage. They asked the court to declare that Safeway is obligated to pay underinsured-motorist benefits to Keith Cooper's estate and to Baker as provided in their policies. Additionally, they alleged claims of breach of contract and bad-faith refusal to pay a claim. In its answer, Safeway admitted that Medlock's policy provided underinsured coverage for the automobile Keith Cooper was driving at the time of the accident but denied that it had breached the contract of insurance or had engaged in bad-faith refusal to pay an insurance claim.
On June 20, 2007, Keith Cooper's estate and Baker moved to intervene in Safeway's action. In their motion, they argued that Medlock and Cooper, the defendants in the declaratory-judgment action filed by Safeway, are not real parties in interest in the action because they had not made a claim for uninsured-motorist benefits from Safeway. In their motion, they state:
"10. Neither Mary Phillips Medlock nor Cassandra Cooper has made a claim for uninsured motorist benefits from Safeway.
"11. As provided by Alabama Rules of Civil Procedure 24, the Estate of Keith Cooper and Johnnie Baker `claim[] an interest relating to the property or transaction which is the subject of the action and the applicant is so situated that the disposition of [this] action' will impede and impair their `ability to protect that interest' because it is these applicants, not the named defendants, who have made a claim for the benefits at issue.
"12. The injuries, harm, and denial by the insurance company to pay the entitled benefits are suffered by the applicants."
Keith Cooper's estate and Baker attached to their motion a complaint against Safeway, asking the trial court to declare that Safeway is obligated to pay the underinsured-motorist benefits and asserting a claim of bad faith.
After conducting a hearing on "all pending motions,"[2] the trial court issued an order stating:
"This cause is before the Court on [Safeway's] complaint for declaratory judgment and the motion to intervene filed by Mary Medlock, as Administratrix of the Estate of Keith Cooper, and Johnnie Baker. After having considered the pleadings and evidentiary submissions filed in this case, along with oral arguments presented by both sides, this Court is of the opinion that judgment is due to be GRANTED in favor of [Safeway] and that the motion to intervene is due to be DENIED."
Medlock, Cooper, Keith Cooper's estate, and Baker appeal.

Standard of Review
To determine the appropriate standard of review, we must first consider the nature of the trial court's judgment for Safeway. The trial court had before it a complaint seeking a declaratory judgment, *507 an answer and counterclaim filed by Medlock and Cooper, an answer to the counterclaim filed by Safeway, and a motion to intervene and a complaint against Safeway filed by Keith Cooper's estate and Baker. It does not appear that the trial court had before it a motion for a judgment on the pleadings or a motion for a summary judgment. Thus, no evidentiary matter appears in the record. Consequently, we will treat the trial court's judgment as having been entered pursuant to the provisions of Rule 12(c), Ala. R. Civ. P., governing judgments on the pleadings in a case. See Deaton, Inc. v. Monroe, 762 So.2d 840, 841-42 (Ala.2000).[3]
"Rule 12(c), Ala. R. Civ. P., provides:
"`After the pleadings are closed but within such time as not to delay the trial, any party may move for judgment on the pleadings. If, on a motion for judgment on the pleadings, matters outside the pleadings are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 56, and all parties shall be given reasonable opportunity to present all material made pertinent to such a motion by Rule 56.'
"When a motion for judgment on the pleadings is made by a party, `the trial court reviews the pleadings filed in the case and, if the pleadings show that no genuine issue of material fact is presented, the trial court will enter a judgment for the party entitled to a judgment according to the law.' B.K.W. Enters., Inc. v. Tractor & Equip. Co., 603 So.2d 989, 991 (Ala.1992). See also Deaton, Inc. v. Monroe, 762 So.2d 840 (Ala.2000). A judgment on the pleadings is subject to a de novo review. Harden v. Ritter, 710 So.2d 1254, 1255 (Ala.Civ.App.1997). A court reviewing a judgment on the pleadings accepts the facts stated in the complaint as true and views them in the light most favorable to the nonmoving party. Id. at 1255-56. If matters outside the pleadings are presented to and considered by the trial court, then the motion for a judgment on the pleadings must be treated as a motion for a summary judgment. See Rule 12(c), Ala. R. Civ. P. Otherwise, in deciding a motion for a judgment on the pleadings, the trial court is bound by the pleadings. See Stockman v. Echlin, Inc., 604 So.2d 393, 394 (Ala.1992)."
Universal Underwriters Ins. Co. v. Thompson, 776 So.2d 81, 82-83 (Ala.2000).
Here, the trial court's ruling rested on the complaint and answer.[4] Therefore, this *508 Court conducts a de novo review, looking only to the pleadings to determine whether the trial court erred in entering a judgment for Safeway.

Discussion
Medlock, Cooper, Keith Cooper's estate, and Baker (hereinafter referred to collectively as "the appellants") contend that the trial court erred in entering a judgment on the pleadings because, they say, genuine issues of material fact are presented as to whether Safeway is obligated to pay underinsured-motorist benefits to Keith Cooper's estate and Baker. According to the complaint, Safeway alleged that it did not owe coverage to Keith Cooper's estate and Baker because, it argued, Keith Cooper was not a "covered person" under either of the policies. According to Safeway, Keith Cooper was a "non-covered person" because he was a family member  Cassandra Cooper's brother  who was not listed as a driver on the application or declarations of the policies and/or had not been added by endorsement to the policies; he was using the vehicle at the time of the accident without a reasonable belief that he was entitled to do so; he was an unlicensed driver or had had his driving privileges suspended; and he was a regular and frequent user of Medlock's vehicle who was not listed on the application or declarations and/or had not been added by endorsement.
In their answer to Safeway's complaint, Medlock and Cooper denied that Keith Cooper was an unlicensed driver; denied that he did not have permission or authorization from Medlock to drive or operate her automobile on the day of the accident; denied that he was a family member or otherwise a member of a policyholder's household under the age of 25 and not listed on the application or declarations and/or not added by endorsement; and denied that he was a regular and frequent user of Medlock's vehicle who was not listed on the application or declarations or added by endorsement.
A de novo review of the pleadings indicates that a genuine issue of material fact exists as to whether Safeway is obligated to pay underinsured-motorist benefits to Keith Cooper's estate and to Baker. The underinsured-motorist policies clearly provide that Safeway will not pay underinsured-motorist benefits to a noncovered person or if the circumstances surrounding the accident are among those listed in the exclusions. Nothing before us indicates as a matter of law that Keith Cooper was a noncovered person or that the circumstances of the accident involved facts that were within the listed exclusions. For this Court to affirm a judgment on the pleadings, the pleadings needed to establish that Keith Cooper was a family member of the policyholder, as that term is defined by the policy, or otherwise a member of the household under the age of 25 who was not listed as a driver on the application or declarations and/or who was not added by endorsement for the policies; that he was a regular and frequent user of Medlock's vehicle who was not listed on the application or declarations and/or who was not added by endorsement to the policies; that he was using Medlock's vehicle without a reasonable belief that he was entitled to do so; or that he was an unlicensed driver or had had his driving privileges suspended. They do not. Consequently, Safeway has not sustained its burden of establishing that Keith Cooper was a "non-covered person," as defined in the policies, or that the circumstances of the accident involved one *509 of the exclusions in the policies. Therefore, Safeway is not entitled to a judgment on the pleadings, and the judgment of the trial court is reversed.
The appellants also contend that the trial court erred in entering a judgment for Safeway because, they say, Safeway did not sue the proper parties. They urge that because this Court in Peachtree Casualty Insurance Co. v. Sharpton, 768 So.2d 368, 371 (Ala.2000) (quoting St. Paul Insurance Co. v. Henson, 479 So.2d 1253, 1253 (Ala.Civ.App.1985)), stated that "`[under]insured motorist coverage inures to a person, not a vehicle,'" a judgment in a case involving an underinsured-motorist claim cannot be entered without suing the parties making the underinsured-motorist claim  here Keith Cooper's estate and Baker.
An insurance policy is a contract. Pate v. Rollison Logging Equip., Inc., 628 So.2d 337 (Ala.1993). The contracts at issue were between Safeway and Medlock and Safeway and Cooper, respectively. Safeway sought a declaratory judgment based on the terms of the contract, the undisputed facts, and applicable law. Therefore, Medlock and Cooper were proper parties for Safeway to sue in seeking a declaration of how the contract was to be interpreted and enforced. Moreover, Medlock and Cooper have asserted counterclaims adverse to the contentions made by Safeway in its complaint for a declaratory judgment. Clearly there is a dispute between Safeway and the two policyholders.
Finally, the appellants contend that the trial court exceeded the scope of its discretion by denying the motion to intervene filed by Keith Cooper's estate and Baker. Keith Cooper's estate and Baker moved to intervene pursuant to Rule 24(a)(2), Ala. R. Civ. P.,[5] which provides:
"(a) Intervention of Right. Upon timely application, anyone shall be permitted to intervene in an action: .... (2) when the applicant claims an interest relating to the property or transaction which is the subject of the action and the applicant is so situated that the disposition of the action may as a practical matter impair or impede the applicant's ability to protect that interest, unless the applicant's interest is adequately represented by existing parties."
Keith Cooper's estate and Baker reasoned that because they, and not Medlock and Cooper, were entitled to receive any underinsured-motorist benefits, Medlock and Cooper could not stand in the place of, defend, or prosecute their interests; therefore, intervention by Keith Cooper's estate and Baker was required.
"`"The decision to grant or to deny a motion to intervene is within the sound discretion of the trial court, and this Court will not disturb that ruling absent an abuse of discretion. In its exercise of discretion, the trial court must determine whether the potential intervenor has demonstrated: (1) that its motion is timely; (2) that it has a sufficient interest relating to the property or transaction; (3) that its ability to protect its interest may, as a practical matter, be impaired or impeded; and (4) that its interest is not adequately represented."'

"Richards v. Izzi, 819 So.2d 25, 33 (Ala. 2001) (quoting City of Dora v. Beavers, 692 So.2d 808, 810 (Ala.1997), citing in turn Valley Forge Ins. Co. v. Alexander, *510 640 So.2d 925, 927 (Ala.1994), and Rule 24(a), Ala. R. Civ. P.). `A "practical" rather than a "technical" approach measures the doctrine of intervention as a matter of right pursuant to Rule 24(a)(2)[, Ala. R. Civ. P.].' Long v. City of Hoover, 844 So.2d 1273, 1281 (Ala.Civ. App.2002)."
Ex parte Caremark RX, Inc., 956 So.2d 1117, 1127-28 (Ala.2006).
A review of the pleadings indicates that the trial court exceeded the scope of its discretion in denying the motion to intervene. Here, Keith Cooper's estate and Baker timely moved to intervene. The motion was filed within four months of the filing of the complaint and before the trial court entered a judgment. Additionally, the pleadings establish that Keith Cooper's estate and Baker, as the potential beneficiaries of the underinsured-motorist policies, have a sufficient interest in the property, see Peachtree Cas. Ins. Co., supra, and, consequently, as a practical matter that the ability of Keith Cooper's estate and Baker to protect their interest will be impaired or impeded, if they are not allowed to intervene. Although Safeway argues that Medlock and Cooper adequately represent the interests of Keith Cooper's estate and Baker, we disagree. If a judgment is entered for Safeway and Keith Cooper's estate and Baker are not parties to the action, then Keith Cooper's estate and Baker are foreclosed by the doctrines of res judicata and/or collateral estoppel from pursuing their interests. Lastly, we conclude that Safeway, in light of our holding that the trial court erred in entering a judgment for Safeway, will not suffer prejudice by allowing Keith Cooper's estate and Baker to intervene. See Ex parte Caremark RX, supra (considering the prejudicial effect on the parties in the existing litigation when reviewing a motion to intervene). Therefore, the trial court exceeded the scope of its discretion in denying the motion to intervene filed by Keith Cooper's estate and Baker.

Conclusion
The trial court's judgment is reversed, and this case is remanded for proceedings consistent with this opinion.
REVERSED AND REMANDED.
BOLIN and PARKER, JJ., concur.
COBB, C.J., and MURDOCK, J., concur in the result.
LYONS, WOODALL, and SMITH, JJ., dissent.
MURDOCK, Justice (concurring in the result).
I concur in the result. I write in reference to the assertion in the main opinion that "[i]f a judgment is entered for Safeway and Keith Cooper's estate and [Johnnie] Baker are not parties to the action, then Keith Cooper's estate and Baker [will be] foreclosed by the doctrines of res judicata and/or collateral estoppel from pursuing their interests." 15 So.3d at 510. Although I question that assertion, I agree that, in light of Rule 24(a), Ala. R. Civ. P., the trial court erred in denying the motion to intervene filed by the estate of Keith Cooper and Baker.
COBB, C.J., concurs.
WOODALL, Justice (dissenting).
I would vacate the judgment, dismiss the appeal, and dismiss the case. Consequently, I respectfully dissent.
"`There must be a bona fide justiciable controversy in order to grant declaratory relief. If no justiciable controversy exists when the suit is commenced, then the court lacks jurisdiction.'" Ex parte Bridges, 925 So.2d 189, 191 (Ala.2005)(quoting Durham v. Community Bank of Marshall County, 584 So.2d 834, 835 (Ala.1991)). In the absence of subject-matter jurisdiction, the trial court can do *511 nothing other than dismiss the action, and any other action taken by it is void. Cadle Co. v. Shabani, 4 So.3d 460, 463 (Ala.2008). Of course, it is well established that a void judgment will not support an appeal.
"`[Under]insured motorist coverage inures to a person. ...' St. Paul Ins. Co. v. Henson, 479 So.2d 1253 (Ala.Civ.App.1985)(citing State Farm Mut. Auto. Ins. Co. v. Jackson, 462 So.2d 346, 353 (Ala.1984))." Peachtree Cas. Ins. Co. v. Sharpton, 768 So.2d 368, 371 (Ala.2000). However, when Safeway filed its declaratory-judgment complaint, it named as defendants only its insureds and did not name as defendants the only claimants for underinsured-motorist benefits  the estate of Keith Cooper and Johnnie Baker. Safeway did not allege the existence of any controversy between it and either named insured and could not have alleged that either named insured had any legal interest in the recovery of underinsured-motorist benefits by the nonparties. In the absence of parties with adverse legal interests, there was no justiciable controversy. See Bridges, 925 So.2d at 192.
LYONS and SMITH, JJ., concur.
NOTES
[1]  The policies define "Family Member" as "a person related to you by blood, marriage or adoption and who regularly lives in your household. This includes a ward or foster child, and includes any child of yours who is only temporarily away from the household."
[2]  The hearing was not transcribed, and the record before us includes only one pending motion  the motion to intervene filed by Keith Cooper's estate and Baker.
[3]  Although the trial court's sua sponte judgement on the pleadings is unusual, our Court of Civil Appeals has confronted a similar situation. In Lary v. Flasch Business Consulting, 909 So.2d 194, 197 n. 3 (Ala.Civ.App.2005), the Court of Civil Appeals noted:

"Although Rule 12(c), Ala. R. Civ. P., envisions the filing of a motion for judgment on the pleadings by one of the parties to an action, caselaw and commentary addressing the analogous Rule 12(c), Fed. R.Civ.P., indicate[] that a trial court may properly enter a judgment on the pleadings sua sponte in a particular case `if it is clear that one side is assured of victory as a matter of law and there is no material factual dispute.' 5C Charles A. Wright & Arthur R. Miller, Federal Practice & Procedure § 1367 & n. 25 (3d ed.2004) (citing Flora v. Home Fed. Sav. & Loan Ass'n, 685 F.2d 209 (7th Cir.1982), Vickery v. Jones, 878 F.Supp. 1179 (S.D.Ill.1995), aff'd, 100 F.3d 1334 (7th Cir.1996), and Bajenski v. Chivatero, 818 F.Supp. 1083 (N.D.Ohio 1993))."
[4]  Even though the trial court considered the policy, the matter remains a judgment on the pleadings because the policy was made part of the complaint and Medlock and Cooper did not dispute its authenticity. Wilson v. First Union Nat'l Bank of Georgia, 716 So.2d 722, 726 (Ala.Civ.App.1998) (holding that the trial court's consideration of documents attached to the complaint, the identity and authenticity of which were not in dispute, did not require conversion of a motion to dismiss into a motion for a summary judgment).
[5]  Baker also moved to intervene pursuant to Rule 24(b)(2), Ala. R. Civ. P., which provides that anyone may be permitted to intervene "when an applicant's claim or defense and the main action have a question of law or fact in common."
