A protein produced by B cells that binds to antigens.