Rare three-body decay t → chγ in the standard model and the two-Higgs doublet model