The best constant in a Hilbert-type inequality