Major Histocompatibility Complex
There is a group of genes known as Major Histocompatibility Complex (MHC), which is essential for our immune system and play an important role in immunological recognition. The MHC is expressed as codominant features of both types of genes, which means the more diverse the set of MHC genes the stronger the immune system. The MHC has evolved to form peptide-MHC complexes that are dispensed in body fluids such as blood serum, saliva, and urine, and also become volatile producing the scents that are attractive to someone genetically different, and thus ensuring genetic diversity for the offspring.
The effect is more commonly seen among females who tend to find males with dissimilar MHCs more attractive than those with similar ones, thus helping avoid incest and birth defects. However, the women who are taking hormonal contraceptives are attracted to those with similar MHCs. Another interesting thing to note is that children who are brought up together, related or not, by the same set of people or parents are less likely to develop sexual attraction as well.