
63 Ill. App.2d 19 (1965)
211 N.E.2d 147
Ralph Paul DePhillips, Plaintiff-Appellee,
v.
Donna Jean DePhillips, a/k/a Donna Jean Harvey, Joan Harvey, a/k/a Joan Bovenzo, and John H. Harvey, Defendants-Appellants.
Gen. No. 50,261.
Illinois Appellate Court  First District, Fourth Division.
September 15, 1965.
Rehearing denied October 11, 1965.
*20 Harvey, Harvey & Wandell, of Chicago, for appellants.
Garretson, Lehmann & Thornquist, of Chicago, for appellees.
MR. PRESIDING JUSTICE McCORMICK delivered the opinion of the court.
On August 21, 1963, Ralph Paul DePhillips, hereafter referred to as plaintiff, filed a complaint seeking equitable relief. In the complaint he alleged, among other things, that on or about June 1951, he and defendant, Joan Harvey, commenced living and cohabiting together, and that they continued living and cohabiting together as if husband and wife (the defendant then being known as Joan DePhillips) for a *21 period of, to wit, nine years, or until, to wit, the month of September 1960, and that to this union a child, Donna Jean DePhillips, was born. He also alleged that at the time he was living with Joan Harvey she had not been divorced from a former husband; that in September 1960, Joan left the plaintiff and on October 25, 1960, she entered into a pretended marriage ceremony with defendant, John H. Harvey. She had taken the child and had left her with the plaintiff's sister, but afterwards she resumed custody of the child.
The complaint further alleged that on November 8, 1962, the defendants, Joan Harvey and John H. Harvey, filed a proceeding in the County Court of Cook County, praying for the adoption of the child, and on December 13, 1962, a purported decree of adoption was entered; that the purported decree is void on the ground that it was founded upon false representations to the court that the petitioners were husband and wife. In his complaint the plaintiff offered to support the child, whether she be in his custody or in the custody of any other person. He also alleged that the defendant, Joan Harvey, is not a fit and proper person to have the care and custody of the child. The plaintiff then prayed that the court adjudicate the marital status of defendant, Joan Harvey (also known as Joan Bovenzo); that the purported decree of adoption be held void; and that the court grant custody of the child to the plaintiff, or in the alternative, grant rights of visitation to him. He further prayed that the court enter an order that the plaintiff contribute to the support of the child and that the defendant expend such monies for the benefit of the child.
Defendants filed a motion to dismiss the complaint on October 29, 1963, on the ground that the complaint does not state a cause of action but merely states a number of facts that are immaterial which gave the *22 court no jurisdiction. The motion also alleged that the relief prayed for by the plaintiff involves matters in which he has no interest and is not a proper party.[*] The court overruled the motion to dismiss and an answer by the defendants was thereupon filed.
The court appointed a guardian ad litem for the child and a report was given to the court from an investigator secured by the guardian. The guardian filed a report and a petition asking that the court determine a reasonable compensation to be paid to him and direct the payment of said fees. On October 26, 1964, the court entered an order fixing the fees of the guardian ad litem at the sum of $1,000, and further ordered that they were to be taxed as costs $500 to be paid by plaintiff and $500 to be paid by defendants. After hearing, the court entered a decree on October 30, finding that Donna Jean DePhillips was the child of the plaintiff; that the child was then aged twelve and a half years; that the plaintiff should have the right of visitation, and that the plaintiff contribute to the support of the child. The court further ordered that Donna remain in the custody of the defendant, *23 Joan Harvey, until further order of the court, and that the questions of contempt of the court be reserved for further consideration.
The defendants filed a notice of appeal on November 19, 1964, in which they appealed;
1) from an alleged finding purportedly entered October 20, 1964, holding the Harveys in contempt;[**]
2) from an order entered October 20, 1964, fixing and apportioning the fees of the guardian ad litem; and
3) from the decree of the court entered October 30, 1964, which provided for visitation rights by the plaintiff and requiring him to make payments for the child's support.
On March 3, 1965, the plaintiff moved to dismiss the appeal. At that time this court directed that there be an oral argument on that motion.
When the plaintiff and Joan Harvey allegedly were living together and when the child was conceived there was in full force and effect a statute (Ill Rev Stats 1955, c 38, sec 46) known as the Criminal Code, which provided as follows:
"If any man and woman shall live together in an open state of adultery, or fornication, or adultery and fornication, every such person shall be fined not exceeding $500, or confined in the county jail not exceeding one year. For a second offense, such man or woman shall be severally punished twice as much as the former punishment, and for a third offense, treble, and thus increasing the punishment for each succeeding offense: ..."
This section remained in effect until it was repealed in 1961, but it was in substance enacted as sections *24 11-7 and 11-8 of chapter 38 of the present Criminal Code which went into effect on January 1, 1962.
At the oral argument this court called the attention of the parties to the classic "Highwayman's Case"[***] reported to have been decided about 1725, which was a bill in chancery brought by one of three highwaymen against the other two, setting out that they had entered into a partnership agreement to do business on "Hounslow Heath," which was "a good and convenient place to deal in," and there dealt with several gentlemen for divers watches, rings, etc., where they were able to prevail on the said gentlemen to deal with them after some small discourse. In that case the court of chancery fined the plaintiff's solicitors and dismissed the complaint.
In Lanteen Laboratories, Inc. v. Clark, 294 Ill. App. 81, 13 NE2d 678 (1938), there was a dispute with reference to a contract dealing with contraceptive devices. A bill in chancery was filed between parties who were engaged in the sale of contraceptives in violation of the existing law. The court said:
"... the question as to whether or not the contract was against public policy was not raised nor suggested in the trial court nor here, but, as we are of the opinion that the contract is tainted with illegality, we will, sua sponte, raise that question, for if we ignored it, it might be reasonably assumed that we considered the contract a legal one. The bold position assumed by plaintiff in this court challenges our attention."
The court cited 21 CJ 180, sec 163, which stated:

*25 "The maxim that he who comes into equity must come with clean hands, or, as it is frequently expressed, that he who has done iniquity shall not have equity, or that he who has done inequity, or has not done equity, cannot have equity, is of ancient origin, and broad application. It is the expression of the elementary and fundamental conception of equity jurisprudence...."
And in Ostrowsky v. Berg, 337 Ill. App. 422, 86 NE2d 546, another case involving illegal contraceptives, the court said:
"... it is the established rule of this State that a contention such as defendants now seek to raise can be asserted for the first time in this court or the Supreme Court; indeed, that it may be raised sua sponte by said courts."
Also see Gehring v. Gehring, 175 Misc 493, 23 NYS2d 920.
[1-4] It is well settled that equity will not lend its aid to the perpetration of criminal acts. Cartlidge v. Rainey, 168 F.2d 841. It is elemental law that a void judgment may be set aside at any time. 23 ILP Judgments § 166. It is held in Barnard v. Michael, 392 Ill. 130, 63 NE2d 858, that a judgment entered by a court which lacks jurisdiction of the parties or the subject matter, or which lacks the inherent power to make or enter the particular order involved, is void, and may be attacked at any time or in any court, either directly or collaterally. See Woodward v. Ruel, 355 Ill. 163, 188 NE 911.
[5, 6] In his motion to dismiss the appeal the plaintiff argues that the case was not properly in this court because of the provisions of section 50(2) of the Civil Practice Act (Ill Rev Stats 1963, c 110, § 50(2)). We *26 are not in accord with the position of the plaintiff; however, we are not specifically passing on that question. Had a motion been made in this court to expunge the judgment which, in our opinion, under the authorities we have cited, is void, it should have been allowed. On its own motion the court here raises that question as in the Lanteen Laboratories case, and the case is reversed and remanded to the Circuit Court of Cook County with directions that the court vacate the decree heretofore entered by it and dismiss the complaint with prejudice.
Reversed and remanded.
DRUCKER and ENGLISH, JJ., concur.
NOTES
[*]   In Wallace v. Wallace, 60 Ill. App.2d 300, 210 NE2d 4, a case recently decided in this court, it was said: "As pointed out in the Illinois Law Review article cited supra [46 Ill L Rev 156 (1951)], the effect of these statutory revisions is basically to place the father of an illegitimate child in the same position as he would have been under common law. Under the common law the father of an illegitimate child was not considered a parent. Wright v. Bennett, 7 Ill. 587 (1845). Under the laws of this state, such a father is a parent only to the extent that he must support his child. It is clear, therefore, that Allen Wallace has absolutely no right to the custody or society of his minor child." Ill Rev Stats 1963, ch 106 3/4, sec 62, is substantially a reenactment of ch 17, sec 49, and provides that a person charged or alleged to be the father of a child born out of wedlock, whether or not adjudicated the father, shall have no right to the custody or control of the child except such custody as may be granted pursuant to an adoption proceeding initiated by him for that purpose.
[**]   This finding appears no place in the record.
[***]   That case, according to Corbin on Contracts, 6A, sec 1530, p 796, was reported in 2 Evans Pothier on Oblig 3, n 1 (1725), and also described in 9 Law Q Rev 197 (1893).
