N.Y. Domestic Relations Law § 142
Where the next friend of an infant, mentally retarded person or mentally ill person maintains an action annulling a marriage, the court may dismiss the complaint if justice so requires, although, in a like case, the party to the marriage, if plaintiff, would be entitled to judgment.