Bulk-hinge correspondence and three-dimensional quantum anomalous Hall effect in second-order topological insulators