The Abell 222 and 223 clusters are located at an average redshift z∼0.21 and are separated by 0.26deg. Signatures of mergers have been previously found in these clusters, both in X-rays and at optical wavelengths, thus motivating our study. In X-rays, they are relatively bright, and Abell 223 shows a double structure. A filament has also been detected between the clusters both at optical and X-ray wavelengths. We analyse the optical properties of these two clusters based on deep imaging in two bands, derive their galaxy luminosity functions (GLFs) and correlate these properties with X-ray characteristics derived from XMM-Newton data. The optical part of our study is based on archive images obtained with the CFHT Megaprime/Megacam camera, covering a total region of about 1deg2, or 12.3x12.3Mpc2 at a redshift of 0.21. The X-ray analysis is based on archive XMM-Newton images. The GLFs of Abell 222 in the g' and r' bands are well fit by a Schechter function; the GLF is steeper in r' than in g'. For Abell 223, the GLFs in both bands require a second component at bright magnitudes, added to a Schechter function; they are similar in both bands. The Serna & Gerbal (1996A&A...309...65S) method allows to separate well the two clusters. No obvious filamentary structures are detected at very large scales around the clusters, but a third cluster at the same redshift, Abell 209, is located at a projected distance of 19.2Mpc. X-ray temperature and metallicity maps reveal that the temperature and metallicity of the X-ray gas are quite homogeneous in Abell 222, while they are very perturbed in Abell 223. The Abell 222/Abell 223 system is complex. The two clusters that form this structure present very different dynamical states. Abell 222 is a smaller, less massive and almost isothermal cluster. On the other hand, Abell 223 is more massive and has most probably been crossed by a subcluster on its way to the northeast. As a consequence, the temperature distribution is very inhomogeneous. Signs of recent interactions are also detected in the optical data where this cluster shows a ``perturbed'' GLF. In summary, the multiwavelength analyses of Abell 222 and Abell 223 are used to investigate the connection between the ICM and the cluster galaxy properties in an interacting system.