At least 24 people have been killed after a boat carrying mourners to a funeral capsized in Nigeria.