diff --git a/include/xlnt/workbook/worksheet_iterator.hpp b/include/xlnt/workbook/worksheet_iterator.hpp
index c1b24a78..444b792f 100644
--- a/include/xlnt/workbook/worksheet_iterator.hpp
+++ b/include/xlnt/workbook/worksheet_iterator.hpp
@@ -88,7 +88,14 @@ public:
/// If the iterator points to one-past-the-end of the workbook, an invalid_parameter
/// exception will be thrown.
///
- worksheet operator*();
+ reference operator*();
+
+ ///
+ /// Dereferences the iterator to return the worksheet it is pointing to.
+ /// If the iterator points to one-past-the-end of the workbook, an invalid_parameter
+ /// exception will be thrown.
+ ///
+ const reference operator*() const;
///
/// Returns true if this iterator points to the same worksheet as comparand.
@@ -175,7 +182,7 @@ public:
/// If the iterator points to one-past-the-end of the workbook, an invalid_parameter
/// exception will be thrown.
///
- const worksheet operator*();
+ const reference operator*() const;
///
/// Returns true if this iterator points to the same worksheet as comparand.
diff --git a/source/workbook/worksheet_iterator.cpp b/source/workbook/worksheet_iterator.cpp
index 0487cf33..3c981339 100644
--- a/source/workbook/worksheet_iterator.cpp
+++ b/source/workbook/worksheet_iterator.cpp
@@ -32,7 +32,12 @@ worksheet_iterator::worksheet_iterator(workbook &wb, std::size_t index)
{
}
-worksheet worksheet_iterator::operator*()
+worksheet_iterator::reference worksheet_iterator::operator*()
+{
+ return (*wb_)[index_];
+}
+
+const worksheet_iterator::reference worksheet_iterator::operator*() const
{
return (*wb_)[index_];
}
@@ -65,7 +70,7 @@ const_worksheet_iterator::const_worksheet_iterator(const workbook &wb, std::size
{
}
-const worksheet const_worksheet_iterator::operator*()
+const const_worksheet_iterator::reference const_worksheet_iterator::operator*() const
{
return wb_->sheet_by_index(index_);
}