
271 N.W.2d 725 (1978)
In re the MARRIAGE OF Peggy Jean HELM and Leonard Gil Helm.
Upon the Petition of Peggy Jean HELM, Appellant,
and Concerning
Leonard Gil HELM, Appellee.
No. 2-61670.
Supreme Court of Iowa.
November 22, 1978.
K. L. Kober, of Pickett & Kober, Waterloo, for appellant.
Peter W. Burk, Waterloo, for appellee.
Considered by REES, P. J., and UHLENHOPP, HARRIS, ALLBEE and LARSON, JJ.
ALLBEE, Justice.
This is a child custody dispute between the mother of Kurt Gilbert Helm and his paternal grandparents. Trial court denied the mother's application to modify the custody provisions of a dissolution decree, holding *726 that it lacked subject matter jurisdiction.
Peggy Jean Helm, applicant and appellant, and Leonard Gil Helm were married on July 19, 1968. Kurt and a second child, Cheriece Marie Helm, were born to this marriage. A dissolution was sought and obtained on January 10, 1972. The decree gave custody of Cheriece to her mother, Peggy, and placed Kurt in the custody of his father's parents, Gilbert and Dortha Helm. On April 21, 1973, Peggy and Leonard remarried. Kurt resided with his parents for a time after the remarriage, but was then returned to his grandparents. The second marriage was dissolved on February 19, 1975, by a decree which again granted custody of Cheriece to her mother. This second decree, however, made no provision for custody of Kurt, who had not even been mentioned in the pleadings.
Subsequent to the second dissolution, Leonard applied for modification of the first decree, asking that custody of Cheriece be placed with him. The district court ordered that Leonard's application be filed in the second dissolution action, and that all further proceedings be in that case.
Finally, on April 11, 1977, Peggy filed the application involved here. Her application demanded that trial court modify the second dissolution decree by providing that custody of Kurt be placed with her. Original notice was served on Leonard, and on the custodial grandparents. Trial court denied the application. It acknowledged the rule that the remarriage of the parties to a dissolution renders the dissolution a nullity, but also recognized the exception to that general rule that where the dissolution decree placed custody in a third party a subsequent remarriage will not affect the third party's right to custody.
No Iowa case has dealt directly with this point. The general rule that remarriage of the parties renders their dissolution a nullity finds widespread support in other states, as illustrated by the cases gathered in Davis v. Davis, 68 Cal.2d 290, 292, 66 Cal.Rptr. 14, 15, 437 P.2d 502, 503 (1968). See also Slape v. Slape, 553 S.W.2d 171, 173 (Tex.Civ.App. 1977), 27B C.J.S. Divorce § 314, at pp. 489-90 (1959). The exception for third-party custody finds support in the only cases which have considered the question. Ex parte Heilman, 176 Kan. 5, 269 P.2d 459 (1954); Miller v. Powell, 212 S.W.2d 876 (Tex.Civ.App.1948) error refusedno reversible error.
Appellant misconstrues the exact nature of the jurisdictional defect which trial court perceived in this case. She appears to believe that trial court denied having jurisdiction over the status to be adjudicated: custody of Kurt. She therefore cites Call v. Call, 250 Iowa 1175, 98 N.W.2d 335 (1959), which held that an Iowa court had jurisdiction to modify its own decree where the applicant-father was domiciled and present in Iowa, the mother was domiciled in Connecticut but appeared personally in the Iowa modification action, and the children, who had been shifted back and forth, were then in Connecticut. Here, there is no difficulty with that variety of jurisdiction because Kurt, both of his parents, and his custodians are domiciliaries of, and physically present in, Iowa. See Iowa Code Ann. § 598A.3(1) (Supp.1978 West); cf. In re Appeal of McLain, 189 Iowa 264, 268-69, 176 N.W. 817, 819 (1920) (distinguishing between jurisdiction over the res and jurisdiction over the subject matter). Rather, trial court's difficulties with the case arose out of the fact that the mother's application to modify was filed in the wrong dissolution proceeding.
We have concluded that we ought to recognize the rule which trial court applied to this case. The purpose and reasoning supporting the general rule regarding nullification of dissolutions by subsequent remarriages have been discussed adequately in Davis, 68 Cal.2d at 292, 66 Cal.Rptr. at 15, 437 P.2d at 503, and cases cited therein, and need no repetition here. However, the exception, that custody in third parties is not so nullified, warrants some brief comment. It is justified because it will, in the majority of cases, work for the best interests of the child. This may be seen when it is considered that custody can be granted to third *727 parties only in derogation of the preference for giving custody to the natural parents. In re Marriage of Smith, 269 N.W.2d 406 (Iowa 1978). Thus, any time a child's custody is given by decree to a third party it is likely to be either because both parents have been found inadequate or because one or both have consented to such custody. Unlike the situation where a parent is given custody, there is no assurance that upon remarriage at least one capable parent will be present.
In addition, we have observed the wisdom of settling custody permanently, to give the child some measure of stability. This permanency and stability will be enhanced by any rule which gives weight to prior dispositions of custody by decree. The rule that custody in third parties is not affected by subsequent remarriage is such a rule. Allowing third-party custodians to participate in modification proceedings, as is now required by Iowa Code Ann. § 598A.4 (Supp.1978 West), is a sound method of assuring that this interest is represented. We therefore recognize that remarriage of the parties to a dissolution nullifies that dissolution except insofar as custody of a child is awarded to third parties.
The district court's earlier refusal to consider the application to modify custody of Cheriece filed in the first action is of no relevance here. That situation was different because Cheriece had remained in the custody of one of her parents, while Kurt had not. Therefore, the first decree as it affected Cheriece was nullified by the remarriage. Because Kurt was in his grandparents' custody, the decree, as it dealt with his custody, remained unaffected.
Recognition that Peggy's application to modify should be brought in the first dissolution does not necessarily imply that trial court was without subject matter jurisdiction, however. Neither Heilman nor Miller go so far. Jurisdiction of the subject matter is the power to hear and decide cases of the general class to which the proceeding belongs. It can be neither conferred on a court nor denied to a court by acts of the parties or the procedures they employ. State ex rel. Iowa State Hwy. Comm'n v. Read, 228 N.W.2d 199, 202 (Iowa 1975). That this applicant chose to file her application in the wrong case did not deprive the court of its power, granted by § 598.21, The Code, to hear such disputes. If the court had heard the case, its action would have been mere error and would not have been taken in the absence of jurisdiction, at least under the present circumstances, where the parties in both cases were identical and all interested persons had been given notice.
This matter may be resolved on the merits by filing an application for modification with the Black Hawk District Court in the first dissolution action. The new proceeding should conform to the applicable requirements of the Uniform Child Custody Jurisdiction Act, Iowa Code Ann. ch. 598A (Supp.1978 West), which took effect on July 1, 1977.
AFFIRMED.
