Bug when trying to normalize vtkQuaterniond

Cannot seem to be ableto normalize a quaterniond:

    std::pair<double, std::array<double, 3>> QuaternionToAngleAxis(const vtkSmartPointer<vtkQuaterniond>& quaternion) {
    vtkQuaterniond normalizedQuaternion = quaternion->Normalized();
    // vtkQuaterniond normalizedQuaternion = (*quaternion).Normalized();
}

It gives this error:

vtk-9.3/vtkSmartPointer.h:191:43: error: invalid ‘static_cast’ from type ‘vtkObjectBase* const’ to type ‘vtkQuaterniond*’
  191 |   T& operator*() const noexcept { return *static_cast<T*>(this->Object); }

Resolved. Was because of using wrapping the quaternion in a vtkSmartPointer.