
754 N.W.2d 813 (2008)
2008 SD 72
Charles E. SISNEY, Plaintiff and Appellant,
v.
Tim REISCHSouth Dakota Secretary of Corrections (in both his official and individual capacities), and Douglas WeberDirector of Prison Operations for South Dakota, (in both his official and individual capacities), Defendants and Appellees.
No. 24683.
Supreme Court of South Dakota.
Considered on Briefs March 26, 2008.
Decided July 23, 2008.
*815 Charles E. Sisney, SD State Penitentiary, Sioux Falls, South Dakota, pro se plaintiff and appellant.
Jeffrey L. Bratkiewicz, Michele A. Munson of Woods, Fuller, Shultz & Smith, P.C., Sioux Falls, South Dakota, Attorneys for defendants and appellees.
*816 ZINTER, Justice.
[¶ 1.] Charles E. Sisney, an inmate in the South Dakota State Penitentiary (SDSP), filed a pro se complaint alleging that he was a third-party beneficiary of a settlement agreement between the Department of Corrections (DOC) and a former inmate. Sisney claimed that DOC and penitentiary officials breached the settlement agreement when they did not provide him with pre-packaged, certified kosher meals. The circuit court dismissed for failure to state a claim. We reverse, concluding that Sisney pleaded sufficient facts to support the inference that defendants were responsible for enforcing the settlement agreement; that Sisney was a third-party beneficiary of the agreement; and that suit on the agreement was not barred by sovereign immunity.

I
[¶ 2.] Sisney pleaded that he is Jewish and follows a kosher diet as part of his religion. Defendant Tim Reisch is the Secretary of the DOC, and Defendant Douglas Weber is the Director of Prison Operations.
[¶ 3.] In 1998, inmate Philip Heftel filed a suit under 42 U.S.C. § 1983 alleging that the DOC had deprived Heftel of his constitutional right to free exercise of the Jewish religion. The parties ultimately entered into a settlement agreement (hereinafter "Heftel Agreement" or "Agreement"), which Heftel and Jeffrey Bloomberg (then Secretary of the DOC) signed in February 2000. The Heftel Agreement provided that the DOC "agree[d] to provide a kosher diet to all Jewish inmates who request it," and that the kosher diet would include "[p]repackaged meals which are certified kosher for noon and evening meals[.]"
[¶ 4.] In February of 2007, the SDSP's food service provider, CBM Inc., quit serving prepackaged kosher meals and began serving a new kosher diet, including a rice and bean mixture prepared and cooked in the SDSP kitchen. Sisney alleged that this change violated the Heftel Agreement and his religious beliefs. Sisney subsequently submitted a grievance through DOC administrative procedures. Weber responded that Sisney was not a party to the Heftel Agreement. Sisney then brought this suit against Reisch and Weber in their individual and official capacities. Sisney alleged that Reisch and Weber breached the Heftel Agreement "in violation of South Dakota Law and Statute(s)."
[¶ 5.] The circuit court dismissed the suit, concluding that Sisney's claim was barred by statutory immunity, and in addition, the complaint did not contain sufficient factual assertions supporting an inference that either Reisch or Weber was responsible for enforcing the Agreement.[1] The circuit court did not reach the issue of whether Sisney had third-party standing to enforce the Heftel Agreement. Sisney now appeals the dismissal and the denial of an opportunity to amend his pleadings.

II
[¶ 6.] A motion to dismiss tests the legal sufficiency of the pleading, and therefore, we review the grant of a motion to dismiss de novo. Elkjer v. City of Rapid City, 2005 SD 45, ¶ 6, 695 N.W.2d 235, 239. "While a complaint attacked by a Rule 12(b)(5) motion to dismiss does not need detailed factual allegations, a plaintiff's obligation to provide the `grounds' of his `entitlement to relief' requires more than labels and conclusions, and a formulaic recitation of the elements of a cause of *817 action will not do.'" Sisney v. Best, 2008 SD 70, ¶ 7, 754 N.W.2d 804 (quoting Bell Atlantic Corp. v. Twombly, ___ U.S. ___, 127 S.Ct. 1955, 1964-65, 167 L.Ed.2d 929 (2007)) (internal citations omitted). The rules "contemplate[ ] [a] statement of circumstances, occurrences, and events in support of the claim presented." Best, 2008 SD 70, ¶ 7, 754 N.W.2d at 808 (quoting Bell Atlantic, ___ U.S. at ___, 127 S.Ct. at 1965 n. 3) (quoting 5 Wright & Miller Federal Practice and Procedure: Civil 3d § 1202, at 94). Ultimately, the complaint must allege facts, which, when taken as true, raise more than a speculative right to relief. Bell Atlantic, ___ U.S. at ___, 127 S.Ct. at 1965. Furthermore, "[w]here the allegations show on the face of the complaint there is some insuperable bar to relief, dismissal under Rule 12(b)([5]) is appropriate." Benton v. Merrill Lynch & Co. Inc., 524 F.3d 866, 870 (8th Cir.2008).

III

A
[¶ 7.] The circuit court first concluded that the complaint failed to state a claim because it contained "no factual assertions supporting an inference that it was the Defendants' responsibility to carry out the [Heftel Agreement]." We disagree with this conclusion.
[¶ 8.] The complaint alleged that Reisch is the current Secretary of Corrections. The Agreement reflects that it was executed on behalf of the DOC by Jeffrey Bloomberg, the former Secretary of Corrections. These facts create a legal inference that Reisch, as the current Secretary of Corrections, is the superseding party responsible for carrying out the Agreement. See SDCL 24-1-4 (providing, [t]he state penitentiary and its ancillary facilities shall be under the direction and government of the Department of Corrections); SDCL 1-15-1.3 (providing, "the secretary of corrections shall be qualified by training and experience to administer the programs of the Department of Corrections"). Similarly, as the alleged Director of Prison Operations for the DOC, Weber's position creates the inference that he may be responsible for enforcing the Agreement at the penitentiary. At this stage in the proceedings, Sisney is entitled to the inference that it was Reisch's and Weber's responsibility to enforce the Heftel Agreement at the SDSP.

B
[¶ 9.] On appeal, Defendants reassert their circuit court argument that Sisney was not entitled to enforce the Agreement as a third-party beneficiary. SDCL 53-2-6-provides, "[a] contract made expressly for the benefit of a third person may be enforced by him at any time before the parties thereto rescind it." In Trouten v. Heritage Mut. Ins. Co., 2001 SD 106, ¶ 13, 632 N.W.2d 856, 858-59, we highlighted the express benefit requirement, noting that the purported third-party beneficiary must clearly show that the contract was entered into with intent to benefit that party:
[W]henever two parties enter into an agreement that appears to have been made expressly for the benefit of a third party, and such agreement has a good and sufficient consideration, the agreement itself creates all the privity there need be between the person for whose benefit the agreement was entered into and the party assuming the obligation, and an action at law should lie regardless of whether there was any obligation existing between the other party to the agreement and the third party. But, before the third party can adopt the agreement entered into and recover thereon, he must show clearly that it *818 was entered into with the intent on the part of the parties thereto that such third party should be benefited thereby.

(Emphasis added). Standing to enforce an agreement as a third-party beneficiary may also be conferred upon a class of individuals. "[T]he terms of the contract must clearly express intent to benefit that party or an identifiable class of which the party is a member." Verni v. Cleveland Chiropractic College, 212 S.W.3d 150, 153 (Mo.2007). "This intent might, in a given case, sufficiently appear from the contract itself [.]" Trouten, 2001 SD 106, ¶ 13, 632 N.W.2d at 859.
[¶ 10.] In this case, the Heftel Agreement clearly expressed that the DOC agreed to provide a kosher diet to an identifiable class of which Sisney was a member; i.e., "to all Jewish inmates who request it." Agreement, ¶ 3. Further, the Agreement expressly reflected an intent to benefit all members of that class: "[i]nmates who request a kosher diet will receive kosher meals regardless of their custody status;" and the DOC "will provide inmates who request a kosher diet a kosher meal prior to the beginning of the fast day and at the conclusion of the fast." Agreement, ¶¶ 3, 4. At the pleading stage of the suit, this explicit contractual language reflected the signatories' intent to provide more than an incidental benefit: the foregoing contractual language raised the inference that the Heftel Agreement was intended to expressly benefit all Jewish inmates who requested a kosher diet. Because Sisney alleged that he was a member of that class, we conclude that Sisney's complaint was sufficient to state a claim that he is a third-party beneficiary with standing to enforce the Heftel Agreement.

C
[¶ 11.] Defendants, however, argue they were immune from suit under SDCL 3-21-8. That statute provides: "No person... is liable for failure to provide a prison, jail, or penal or correctional facility, or if such facility is provided, for failure to provide sufficient ... services in a prison or other correctional facility." SDCL 3-21-8. The circuit court agreed, concluding that this language "indicates a legislative intent to provide ... immunity to the state and state officials, regardless of whether the potential liability will derive from tort or contract." The court further concluded that "[t]his same analysis can be applied to SDCL 3-21-9[.]"[2] We disagree with the circuit court's analysis.[3]
[¶ 12.] Sisney sued Defendants in their individual and official capacities. "[I]t is well-settled that suits against officers of the state `in their official capacity, [are] in reality [suits] against the State itself.'" Dan Nelson, Auto., Inc. v. Viken, 2005 SD 109, ¶ 23, 706 N.W.2d 239, 247 (citations omitted). It is further settled that the State is generally immune from suit under Article III Section 27 of the South Dakota Constitution. With respect to individual capacity suits, state employees who are "sued in an individual capacity [are] entitled to immunity depend[ent] upon `the function performed by *819 the employee.'" Casazza v. State, 2000 SD 120, ¶ 11, 616 N.W.2d 872, 875 (citation omitted). State employees are generally immune from suit when they perform discretionary functions, but not when they perform ministerial functions. Wulf v. Senst, 2003 SD 105, ¶ 20, 669 N.W.2d 135, 142. Finally, immunity may have been available under SDCL 3-21-8 and 3-21-9. Therefore, whether acting in official or individual capacities, we may assume without deciding that the Defendants may have been generally cloaked with sovereign immunity in performing their duties for the DOC.
[¶ 13.] Nevertheless, even when sovereign immunity is applicable, it is waived to the extent the State entered into a contract and a party or third-party beneficiary sues to enforce that contract. In Wilson v. Hogan, 473 N.W.2d 492, 494 (S.D. 1991), this Court noted that the State may waive its immunity "by entering into a contract which implicitly gives the other party to the contract a right of action upon it." In Blue Fox Bar, Inc. v. City of Yankton, 424 N.W.2d 915, 917-18 (S.D. 1988), we explicitly stated that "immunity is not a defense to a claim against the state for contractual liability arising out of either governmental or proprietary operations." Therefore, at the pleading stage of the proceedings, Sisney's complaint states a claim to the extent that he is pursuing a third-party beneficiary contractual cause of action to enforce the Agreement.[4]

D
[¶ 14.] We finally observe that Sisney's complaint also sought declaratory relief. SDCL 3-21-8 and 3-21-9 only provide immunity from suits seeking to impose liability. See Clay v. Weber, 2007 SD 45, ¶ 7, 733 N.W.2d 278, 282 (considering SDCL 3-21-8 and SDCL 3-21-9, which immunize persons, political subdivisions, and the state from liability) (emphasis added). See also Dakota Sys., Inc. v. Viken, 2005 SD 27, ¶ 9, 694 N.W.2d 23, 28 (providing that the "declaratory judgment action does not violate the principles of sovereign immunity"). Therefore, immunity is not generally available to the extent Sisney only seeks declaratory relief. "[A] declaratory judgment action attacking the constitutionality of a statute or seeking relief from an invalid act or an abuse of authority by an officer or agent is ... not prohibited by principles governing sovereign immunity." Nelson, 2005 SD 109, ¶ 27, 706 N.W.2d at 250. For these reasons, Sisney was entitled to pursue his claim for declaratory relief.
[¶ 15.] Considering Sisney's factual assertions in a light most favorable to the pleader, the complaint stated a third-party beneficiary cause of action for enforcement of the Heftel Agreement and for declaratory relief. In light of this conclusion, we do not consider Sisney's argument regarding amendment of the complaint.
[¶ 16.] Reversed and remanded.
[¶ 17.] GILBERTSON, Chief Justice, and SABERS, KONENKAMP, and MEIERHENRY, Justices, concur.
NOTES
[1]  The court concluded that Sisney's complaint merely alleged that Reisch and Weber held positions in the DOC, and that Weber had merely responded to Sisney's grievance.
[2]  That statute provides, "[n]o person ... is liable for any injury caused by or resulting from ... [s]ervices or programs administered by or on behalf of the prison, jail, or correctional facility." SDCL 3-21-9.
[3]  Defendants argue that Sisney waived the immunity issue because he did not brief it on appeal. Sisney's brief, however, argues that no immunity is available because the contract mandates that certified kosher meals shall be provided and that the provision of certified kosher meals is a ministerial act for which immunity is unavailable. Thus, the issue of immunity was not waived.
[4]  For this reason, we need not address the ministerial/discretionary distinction of sovereign immunity under SDCL 3-21-8 and 3-21-9.
