As neural circuits form, growing processes select the correct synaptic partners through interactions between cell surface proteins. The presence of such proteins on two neuronal processes may lead to either adhesion or repulsion; however, the consequences of mismatched expression have rarely been explored. Here, we show that the Drosophila CUB-LDL protein Lost and found (Loaf) is required in the UV-sensitive R7 photoreceptor for normal axon targeting only when Loaf is also present in its synaptic partners. Although targeting occurs normally in loaf mutant animals, removing loaf from photoreceptors or expressing it in their postsynaptic neurons Tm5a/b or Dm9 in a loaf mutant causes mistargeting of R7 axons. Loaf localizes primarily to intracellular vesicles including endosomes. We propose that Loaf regulates the trafficking or function of one or more cell surface proteins, and an excess of these proteins on the synaptic partners of R7 prevents the formation of stable connections.