Let the shadow cast by lighthouse on the beach and the friend occur on the same time, then the triangle formed by lighthouse and its shadow and the triangle formed by friend and its shadow must be similar.
We know that the sides of two similar triangles are proportional.