Tens of thousands of people packed St Peter's Square for the funeral of Pope Francis before his body was carried through the streets of Rome.