(a) The court may authorize executors, administrators and trustees to adjust by compromise any controversy that may arise between different claimants to the estate or property in their hands to which agreement such executors, administrators or trustees and all other parties in being who claim an interest in such estate and whose interests are affected by the proposed compromise shall be parties in person or by guardian as hereinafter provided.
(b) The court may likewise authorize the person or persons named as executors in one or more instruments purporting to be the last will and testament of a person deceased, or the petitioners for administration with such wills or wills annexed, to adjust by compromise any controversy that may arise between the persons claiming as devisees or legatees under such will or wills and the persons entitled to or claiming the estate of the deceased under the provisions of chapter 3 of this title, to which agreement or compromise the persons named as executors or the petitioners for administration with the will annexed, as the case may be, those claiming as devisees or legatees and those claiming the estate as intestate, shall be parties, provided that persons named as executors in any instrument who have renounced or shall renounce such executorship and any person whose interest in the estate is unaffected by the proposed compromise shall not be required to be parties to such compromise.
(c) Where an infant, lunatic, person of unsound mind or habitual drunkard is a necessary party to a compromise under this section he shall be represented in the proceedings by a special guardian appointed by the court, who shall in the name and on behalf of the party he represents make all proper instruments necessary to carry into effect any compromise that is sanctioned by the court.
(d) If it appears to the satisfaction of the court that the interests of persons unknown or the future contingent interest of persons not in being are or may be affected by the compromise, the court shall appoint some suitable person or persons to represent such interest in the compromise and to make all proper instruments necessary to carry into effect any compromise that is sanctioned by the court. If, by the terms of any compromise made pursuant to this section, money or property is directed to be set apart or held for the benefit of or to represent the interest of infants, incompetents or persons unknown or unborn, the same may in a proper case be paid or deposited in court and remain subject to the order of the court.
(e) An agreement of compromise made in writing pursuant to this section, if found by the court to be just and reasonable in its effects upon the interests in said estate or property of infants, lunatics, persons of unsound mind, unknown persons or the future contingent interests of persons not in being, shall be valid and binding upon such interests as well as upon the interests of adult persons of sound mind.
(f) An application for the approval of a compromise pursuant to this section must be made by petition duly verified, which shall set forth the provisions of any instruments or documents by virtue of which any claim is made to the property or estate in controversy and any and all facts relating to the claims of the various parties to the controversy and the possible contingent interests of persons not in being and all facts which made it proper or necessary that the proposed compromise be approved by the court. The court in its discretion may entertain such application prior to the execution of the proposed compromise by all the parties required to execute it and may permit the execution by the necessary parties to be completed after the inception of the proceeding for approval thereof if the proposed compromise has been approved by the estate representatives described in subsections (a) and (b) of this section. The court shall inquire into the circumstances and make such order or decree as justice requires. The order or decree may also be made in any pending proceeding.