diff --git a/src/fwd.hpp b/src/fwd.hpp
index 37aa6a2033dc705e6207e0086a0f138a41d6a91f..1fe3dd1d496bacaf63e2277b484443077d4c9f82 100644
--- a/src/fwd.hpp
+++ b/src/fwd.hpp
@@ -22,11 +22,11 @@
 
 namespace eigenpy
 {
-  template<typename D>
+  template<typename D, typename Scalar = typename D::Scalar>
   struct UnalignedEquivalent
   {
     typedef Eigen::MatrixBase<D> MatType;
-    typedef Eigen::Matrix<typename D::Scalar,
+    typedef Eigen::Matrix<Scalar,
              D::RowsAtCompileTime,
              D::ColsAtCompileTime,
 #ifndef EIGENPY_ALIGNED