When is a maternal effect adaptive