Experimental studies of rare B- and D-meson decays at CLEO