A framework for comparing processes of speciation in the presence of gene flow